[nSLUG] Time services

Peter Cordes peter at llama.nslug.ns.ca
Wed Mar 19 17:54:41 AST 2003

On Wed, Mar 19, 2003 at 04:43:47PM -0400, Jamie Fifield wrote:
> I'm going to include a bunch of replies in this one email. :)
> 1. I believe timeserver.dal.ca is a tier 3 NTP server.  Frankly, for
> most purposes, one don't need to load the tier 2 servers.

 That's correct, but dal has some stratum 2 servers.  Eastlink also has an
NTP server.  There's really no need to go loading up the public timeservers
if you're on eastlink, because eastlink has private peering with Dal, so
traffic between you and Dal is very fast.  Besides that, you can keep your
clocks accurate enough by just syncing up once a day, instead of constantly
running ntpd.  /etc/cron.daily/set_clocks:
# Set system clock from an NTP server

. /etc/default/rcS
. /etc/default/ntp-servers

if /usr/sbin/ntpdate $NTPSERVERS ;then
	if [ yes = $UTC ];then /sbin/hwclock --utc --systohc
	   else			/sbin/hwclock --systohc

 I use adjtimex to correct the clock drift so that the clock is only off by
0.1 seconds or so over a day.  Once you figure out your clock's drift rate,
you can set /etc/adjtimex.conf, and /etc/init.d/adjtimex will load the
correction at bootup, and you never have to worry about it.  It would be
better if my ntpdate script kept fine-tuning the adjtimex parameters (so you
didn't have to do it by hand in the first place), but it's ok the way it is.
Of course, if you do run ntpd, don't use adjtimex.  ntpd takes care of
tweaking the clock increment itself.

llama]~$ ntpdate -q time.eastlink.ca timeserver.dal.ca spike.ucis.dal.ca
server, stratum 2, offset 0.051820, delay 0.04008
server, stratum 3, offset 0.030925, delay 0.03267
server, stratum 2, offset 0.034540, delay 0.04185
server, stratum 2, offset 0.030438, delay 0.03391
19 Mar 17:33:39 ntpdate[12445]: adjust time server offset
0.030438 sec

snoopy.ucis.d.c == timeserver.d.c, and z3.e.c == time.e.c.

 Eastlink's time server is stratum 2.  I recommend just using one of the Dal
servers, and eastlink's server, and not adding traffic to any more than that.

> 2. If network latency to ntp servers is an issue for you (I don't see
> how it is, because the protocol takes into account latency and
> compensates for it), run your own ntp server.  To do this on Debian:
> apt-get install ntp

z3's latency is jittery this time of day:

llama]~$ ping z3.eastlink.ca
PING z3.eastlink.ca ( from : 56(84) bytes of data.
64 bytes from z3.eastlink.ca ( icmp_seq=1 ttl=253 time=19.5 ms
64 bytes from z3.eastlink.ca ( icmp_seq=2 ttl=253 time=39.0 ms
64 bytes from z3.eastlink.ca ( icmp_seq=3 ttl=253 time=72.7 ms
64 bytes from z3.eastlink.ca ( icmp_seq=4 ttl=253 time=14.2 ms
64 bytes from z3.eastlink.ca ( icmp_seq=5 ttl=253 time=56.3 ms
64 bytes from z3.eastlink.ca ( icmp_seq=6 ttl=253 time=34.7 ms
64 bytes from z3.eastlink.ca ( icmp_seq=7 ttl=253 time=16.7 ms

--- z3.eastlink.ca ping statistics ---
7 packets transmitted, 7 received, 0% loss, time 6059ms
rtt min/avg/max/mdev = 14.223/36.198/72.741/20.321 ms

(note mdev (mean or median deviation, I guess) of 20ms).

 I think later at night, when my set_clocks script runs, there is less
jitter.  Of course, ntpdate detects the jitter and chooses one of the Dal
servers instead :)

#define X(x,y) x##y
Peter Cordes ;  e-mail: X(peter at llama.nslug. , ns.ca)

"The gods confound the man who first found out how to distinguish the hours!
 Confound him, too, who in this place set up a sundial, to cut and hack
 my day so wretchedly into small pieces!" -- Plautus, 200 BC

More information about the nSLUG mailing list