I'm seeing demand for NTS rather than SNTP. I’d be interested in an implementation of that.
Jeff Thompson | Senior Electrical Engineer - Firmware +1 704 752 6513 x1394 www.invue.com -----Original Message----- From: lwip-users-bounces+jeffthompson=invue....@nongnu.org <lwip-users-bounces+jeffthompson=invue....@nongnu.org> On Behalf Of Giuseppe Modugno Sent: Friday, December 30, 2022 11:11 AM To: lwip-users@nongnu.org Subject: [lwip-users] [OT] Sync local time to NTP The typical scenario of lwip is an embedded platform. When a wall clock is needed and the device is network connected, NTP is usually used to retrieve automatically the correct time at startup and stay in sync with an accurate reference (in other cases, the user can set a time as he wants). Consider an embedded device without a battery. At startup there's no notion of current time, so we can start from an epoch (1970, 2020 or whatever) and consider it the correct time. Another approach is considering the time not initialized at all. lwip has a SNTP client implementation that magically calls a function SNTP_SET_SYSTEM_TIME_NTP(s, f) when a response from a SNTP server is received. Now the question is what to do with s, seconds from 1970 epoch (ignore fractional part, just to simplify). One possibility is to have a system counter clocked at 1s that counts seconds from 1970. So SNTP_SET_SYSTEM_TIME_NTP() could simply overwrite the counter value. However this simple approach brings to a counter that isn't monotonic and continuous. I know the best approach is to slowed down or accelerate the reference clock of the system counter that tracks seconds from epoch. Do you really implement something similar or are you happy with replacing the counter with the new value reported by NTP? _______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users _______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users