ESP32 Time Library Sync Interval

Hello,
I have been trying to figure out how ESP32 Built in "time.h" library Syncs with NTP. Mainly I am trying to figure out the interval at which it syncs. I have seen some forums state that the getLocalTime function sends an NTP request. I don't know if that is the case. the way I currently understand it is the following:
configTime called in the setup loop syncs time with NTP server.
getLocalTime function reads the internally kept Time.
"behind the scenes" the ESP32 library periodically synchronizes with NTP Server.

Is this understanding correct?
If so, how often does the ESP32 sync it's time. If it does not sync it's time, what function do I need to use to sync it every couple days?

If the getLocalTime function is making an NTP request on every call, How do I stop that so that I don't do that every 10 ms or whatever my sample time is set to? Seems that would not be good practice to make an NTP request every 10mS but I need to get a fast update time in my script.

thanks,

I found the answer. it appears that it does work as I suspect. SNTP ESP32 info

An application with this initialization code will periodically synchronize the time. The time synchronization period is determined by CONFIG_LWIP_SNTP_UPDATE_DELAY (default value is one hour). To modify the variable, set CONFIG_LWIP_SNTP_UPDATE_DELAY in project configuration.

and in the arduino ESP32 module the config time calls the init function.

void configTime(long gmtOffset_sec, int daylightOffset_sec, const char* server1, const char* server2, const char* server3)
{
    //tcpip_adapter_init();  // Should not hurt anything if already inited
    esp_netif_init();
    if(sntp_enabled()){
        sntp_stop();
    }
    sntp_setoperatingmode(SNTP_OPMODE_POLL);
    sntp_setservername(0, (char*)server1);
    sntp_setservername(1, (char*)server2);
    sntp_setservername(2, (char*)server3);
    sntp_init();
    setTimeZone(-gmtOffset_sec, daylightOffset_sec);
}

Source code can tell you… it’s in that file arduino-esp32/esp32-hal-time.c at 92ce408f4c71d235f0961a265e8d202f9fd570d5 · espressif/arduino-esp32 · GitHub

Also read this

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.