gmag11 / ESPNtpClient

High accuracy NTP library for ESP32 and ESP8266
MIT License
118 stars 25 forks source link

Hook into the Synch Event to update a DS3231 RTC? #52

Open tfcroft4 opened 10 months ago

tfcroft4 commented 10 months ago

My device is a real time clock that can be configured at base where there my be an internet connection and then deployed 'in the field' where there will not be an internet connection available. I would like to use the NTP synchronise event on the ESP32 to update the external DS3231 RTC. The RTC gives an accurate time reference and is battery backed so is available through power cycles. When NTP is available then I can get time synchronisation via the internet.

The ESP code base has the NTP sync callback: sntp_set_time_sync_notification_cb(cbSyncTime); which can be used to trigger an DS3231 update.

What would be the equivalent in the ESPNtpClient system to get a tight synchronisation of the System Time and the DS3231. After the 'event' I would wait for a second rollover to set the DS3231 time as close as possible to the system time. Thanks Ted