Hello.
I’ve written code to update the ESP32 internal RTC w/ the date and time from NTP severs. There’s connection to the internet and the RTC gets updated to the correct time provided by one of the NTP servers as expected. However, after a day or so, the RTC starts to drift and it never corrects itself. It behaves as if the synch from the NTP server occurred just one time. Here’s what the code is doing:
- It calls configTime(0, 0, “pool.ntp.org”, “time.nist.gov”, “time.google.com”) once.
- It calls sntp_set_sync_interval(60000) once.
- Then it goes into a loop calling the getLocalTime () function;
As mentioned above, the time and date are correct initially but after about 24 hours I start noticing a drift in the time returned by getLocalTime(), i.e., it no longer matches the current time. It is as if the RTC only got updated once. Any ideas as to why this is happening?