My custom built ntpd has been running for over 40hours. It's stable like a rock. So is its memory usage:
Code:
PID USER PRI NI VIRT RES SHR DATA S CPU% MEM% TIME+ Command
24617 admin 20 0 1280 1184 932 308 S 0.0 0.5 0:00.31 ntpd -c /jffs/etc/ntp.conf
VIRT/RES/DATA never moved a bit. For all the hard work (*cough*) done to keep accurate time, ntpd only consumes 0.31s of CPU time over the 40+ hour of service.
Let's look at the running status and time accuracy ("remote" edited below):
Code:
/jffs$ bin/ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*ts0.its.chk.e .GPS. 1 u 532 1024 357 2.082 -0.646 0.439
+xxx.xxx.xxx.x .MRS. 1 u 176 1024 313 4.792 -1.158 1.089
+yyy.yyy.yy.yy .MRS. 1 u 304 1024 375 3.005 -0.710 3.522
The time server with a GPS reference clock (as in
"refid" column) is my current primary source (hence with an asterisk) which ntpd monitors and switches dynamically. The other two with MRS* are standby. Hence the "+". All these three are
stratum 1 as indicated under "st" column. Stratum 1 time server is the best you could get for free. Go for it if there is one near you..
ntpd starts with a polling period of 64s and gradually prolongs to 1024s (the "poll" column) as it gets confidence. Over the course of 40+ hours, drift increases slightly from 7.3-ish to 7.979 as of this writing:
Code:
/jffs$ cat /opt/var/log/ntp/ntp.drift
7.979
A drift value is the current clock deviation observed on my AC56U. It's in the unit of "parts per million". 7.979 PPM
translates into 0.69s per day (or 57.5ms every two hour). Is that accurate enough for daily use? I believe so...in fact I'm more interested in the drift value sticking with its words. I dug out my old script from its coffin and took an observation every two hours. Here is the result:
Code:
TIMESTAMP DEVIATION (us)
15091720 3630.37
15091722 1164.09
15091800 605.96
15091802 87.96
15091804 1.69
15091806 50.45
15091808 -155.63
15091810 664.57
15091812 48.85
15091814 13.55
15091816 -233.66
15091818 505.59
15091820 -423.84
15091822 -278.00
15091900 422.04
15091902 484.62
15091904 -157.48
15091906 -960.09
15091908 -1109.47
15091910 -630.18
15091912 -403.41
The deviation is in unit of micro-seconds e.g. the first reading 3630.37us = ~3.63ms. When ntpd starts, it polls time servers more frequent and adjust the system clock accordingly. Observant folks might see the slow ramp up (i.e. reduction in deviation) in the first few hours. I believe that's intended since I enforced
"always slew adjustment" in my build (with --enable-slew-always) and ntpd need time to slew..through I think.
If we eliminate the first two as outliers, then the worst deviation per two hour is at 15091908 with ~1.11ms. If we treat this as worst drift, then it translates to 13.3ms per day (1.11*12). Bravo! In reality it seems working much better than anticipated.
It's great to have ntpd on my AC56U. I think this 1184KiB memory is well spent. Note that the stock yet dumb ntp consumes more memory than that.
@ASAT Will your setup output a refid of .GPS. or .PPS.?
@Cake You bump into all walks of life here..that's fun.
*for a moment, I wondered... what was
.MRS. Wish I could get one of them...maybe a PCI card from ebay?