Hi,
I'm using the SNTP component of the IDF framework, with the SNTP_SYNC_MODE_SMOOTH mode. I want to be aware each time a synchronization occurs that will not be smooth because the time delta to correct is greater than 35 minutes (meaning no call to adjtime, but direct call to settimeofday).
However this appears impossible to do with just the SNTP component interface. I first thought of checking the synchronization status in the synchronization callback, with SNTP_SYNC_STATUS_IN_PROGRESS meaning a smooth synchronization was planned and SNTP_SYNC_STATUS_COMPLETED meaning a harsh synchronization had been executed. But there is the edge case where the time delta to correct is really small, and by the time I'm checking the synchronization status, adjtime is done with its job and the status has already switched from SNTP_SYNC_STATUS_IN_PROGRESS to SNTP_SYNC_STATUS_COMPLETED, in which case I would incorrectly assume there has been a harsh synchronization even though there has not.
I can implement something to retrieve the delta that has been applied by comparing the monotonic esp_timer_get_time() clock to the 'gettimeofday' clock, but that seems a bit overkill. Is there another way I'm missing?
Find if an NTP synchronization in smooth mode was actually smooth or not
-
Challenger
- Posts: 1
- Joined: Sun Apr 06, 2025 11:21 am
Who is online
Users browsing this forum: No registered users and 1 guest