ESP32Time
ESP32Time copied to clipboard
Month is -1 after setting local time, for what?
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...
https://www.cplusplus.com/reference/ctime/tm/
tm_mon range is 0 - 11
#13