In ESP32Time.cpp, setTime(sc, mn, hr, dy, mt, yr, 0) sets the date to year=yr-1900, month=mt-1, day=dy.
For yr, the 1900 offset is fine, as getYear() returns timeinfo.tm_year+1900.
But for mt, getMonth returns timeinfo.tm_mon, not timeinfo.tm_mon+1. This creates problems when you change the time.
For example,
int sc = rtc.getSecond();
int mn = rtc.getMinute();
int hr = rtc.getHour();
int dy = rtc.getDay();
int mt = rtc.getMonth();
int yr = rtc.getYear();
rtc.setTime(sc, mn, hr, dy, mt, yr + 1, 0); // Increments year correctly
rtc.setTime(sc, mn, hr, dy, mt + 1, yr, 0); // Fails to increment month
rtc.setTime(sc, mn, hr, dy + 1, mt, yr, 0); // Increments day correctly
In ESP32Time.cpp, setTime(sc, mn, hr, dy, mt, yr, 0) sets the date to year=yr-1900, month=mt-1, day=dy. For yr, the 1900 offset is fine, as getYear() returns timeinfo.tm_year+1900. But for mt, getMonth returns timeinfo.tm_mon, not timeinfo.tm_mon+1. This creates problems when you change the time.
For example,
int sc = rtc.getSecond(); int mn = rtc.getMinute(); int hr = rtc.getHour(); int dy = rtc.getDay(); int mt = rtc.getMonth(); int yr = rtc.getYear();
rtc.setTime(sc, mn, hr, dy, mt, yr + 1, 0); // Increments year correctly rtc.setTime(sc, mn, hr, dy, mt + 1, yr, 0); // Fails to increment month rtc.setTime(sc, mn, hr, dy + 1, mt, yr, 0); // Increments day correctly