Closed misisl closed 1 year ago
i see this in code:
void ESP32Time::setTime(int sc, int mn, int hr, int dy, int mt, int yr, int ms) { // seconds, minutes, hours, days, months, years $ microseconds(optional) // ie setTime(20, 34, 8, 1, 4, 2021) = 8:34:20 1/4/2021 struct tm t = {0}; // Initialize it to all 0's t.tm_year = yr - 1900; // This is year-1900, so 121 = 2021 t.tm_mon = mt - 1; t.tm_mday = dy; t.tm_hour = hr; t.tm_min = mn; t.tm_sec = sc; time_t timeSinceEpoch = mktime(&t); setTime(timeSinceEpoch, ms); }
for how reason is t.tm_mon = mt - 1;? If I set the date, I read a date with last month...
t.tm_mon = mt - 1;
https://www.cplusplus.com/reference/ctime/tm/
tm_mon range is 0 - 11
tm_mon
i see this in code:
for how reason is
t.tm_mon = mt - 1;
? If I set the date, I read a date with last month...