Esp32 time is 1 month in the future

Don’t understand this, esp32 time after ntp sync, the time reported is EXACTLY 1 month in the future:

while (WiFi.status() != WL_CONNECTED) delay(250);
configTime(0, 0, “``pool.ntp.org``”);
while (time(nullptr) < 1000000000) delay(100); // wait until epoch valid
time_t now;
time(&now);
cl(getTime());
cl(“Now UTC: %s”, ctime(&now));
cl(esp_get_idf_version());

v4.4.7-dirty
1762051519
Epoch 1762051519Sunday, November 30 2025 18:25:19 UTC
cl() is just an alias to Serial.println

Does anybody else see this ??

Depending upon your location, you may have tried this exactly during the hour that exists twice. (You omitted your call to setTimezone, so we don’t know.) It wouldn’t be shocking if that’s a code path that’s not well exercised since it happens in the US exactly one hour per year.

Of course, your code is going to give the appearance of a lockup if it’s unable to contact pool.ntp.org for whatever reason. Depending on where you’re calling that from, you may even encounter an unhandled watchdogtimer interrupt.

This isn’t a platformio issue.

I have no problems here. See

Choose your timezone in line 28 and run the simulation.

Thanks, I assumed incorrectly that if you dont set a timezone it will just use UTC and all will be good, but it appears not.

After setting the timezone all works as expected.

Thanks VERY much, I spent many hours trying to figure that out and chatGPT never suggested checking that, good old humans solved it.

:wink:

1 Like