I got round to looking at why NTPD wasn't succeeding in keeping my 2 Joggler clocks in sync.
ntpdate sets the clock initially but I was having issues when there's no Internet available during boot - the clock never got set. Despite ntpd running, it's not doing anything useful - or not for me on a couple of Jogglers runing PNP3.6 anyway. Even if the clock was set at boot, it seems to drift away noticeably over time as others have observed. For me, the drift file in /tmp was always showing 0.000 which is the clue.
Yes, you can invoke ntpdate on a cron job (using busybox.new's crond), a little messy, but works.
But the stock ntpd can sync with a local network ntpd server (4.2.8 - i.e. current), as well as pool.ntp.org with a couple of small tweaks to the udhcpc.script. With my tweaks, the Joggler can automatically read the time server address configured by the network's DHCP server (option "ntp-servers" on a standard ISC DHCP server, doubtless similar on others), avoiding the need to hard-code local NTP server addresses in Joggler(s). I attach the revised script which sits in /etc on the Joggler FYI.
I also made the config a bit more robust so it can move the clock a long way rather than the default which is to give up on anything over 1000s, using "tinker panic 0", and added a log command so you can see when and what it's synced to.
The script falls back to 0.pool.ntp.org, as before, if no ntp server address is provided by the DHCP server.
A second pool server can be added by removing the comment "stratum 1" - should you really want stratum 1 ! (ntpd will use the "best" available when it starts).
For me, it will only keep sync if it finds a time server when ntpd starts, it will then jump the time by as far as needed (ntpdate no longer really needed). The advantage of using a local time server set by DHCP is that you can guarantee a time server is always available when ntpd starts, so it keeps time properly. The fall-backs at pool.ntp.org are not necessarily always available on your network.
Your log might look like this for a local server:
Code: Select all
10 Aug 19:02:18 ntpd: synchronized to 10.0.0.100, stratum 3
10 Aug 19:02:18 ntpd: kernel time sync status change 0001
or the fallback for 0.pool.ntp.org
Code: Select all
11 Aug 10:54:05 ntpd: synchronized to 126.96.36.199, stratum 1
11 Aug 10:54:05 ntpd: kernel time sync status change 0001
You can check for a nonzero drift value in the drift file after a while (can take several hours to write the file, and you can check how it varies over time). My 2 Jogglers are different, and vary a bit (-55ppm on one, -30ppm on another, i.e. a few secs a day, as expected for a consumer crystal oscillator).
Now the second hand of the screensaver clock exactly matches my MSF radio-controlled analogue clock on the wall