mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
ntp: keep the time from an NTP server
The switch has no battery backed clock, only a seconds counter that starts at zero on every boot. An SNTP client keeps UTC as the time of the last answer plus the seconds counted since: "ntp server <name|ip>", "ntp interval <minutes>", "ntp timezone <+hh:mm>", "ntp dst off|eu|us", "ntp on|off", "ntp" and "time". A server given by name goes through the DNS resolver, an answer from an unsynchronised server is ignored, and a failed attempt is repeated after 30 seconds. The local time adds the time zone offset and, while the European or United States rule says so, one hour. The date is split with a shift and subtract division and a walk over the years, so no 32-bit division from the library ends up in the common area. The System page gets the NTP settings and shows the local time.
This commit is contained in:
1 parent
67b8c718fb
commit
3cd6d60e0b
11 files changed
+618
-8
No files matched your search
@@ -4,6 +4,7 @@
|
||||
#include "dhcp.h"
|
||||
#include "syslog.h"
|
||||
#include "dns.h"
|
||||
#include "ntp.h"
|
||||
|
||||
void udp_callbacks(void);
|
||||
|
||||
|
||||
Reference in new issue
Block a user