lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] [OT] Sync local time to NTP


From: Thompson, Jeff
Subject: Re: [lwip-users] [OT] Sync local time to NTP
Date: Fri, 30 Dec 2022 16:28:11 +0000

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.com@nongnu.org 
<lwip-users-bounces+jeffthompson=invue.com@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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]