clock synchronization

R. Hirschfeld yellowdog-general@lists.terrasoftsolutions.com
Sun Jun 20 07:42:01 2004


For some reason my system clock has started running slow. losing about
26 seconds per day.  The hardware clock is accurate, but since the
hardware clock is set to the system clock at shutdown, it gets
corrupted by the bad system clock.

To remedy this, I installed the adjtimex package and used it to modify
the kernel time variables, setting 10003 instead of 10000 microseconds
per tick.  This helped considerably, although I'm still playing with
the frequency variable to improve the accuracy.

What's a good way to set this automatically at boot time rather than
having to do it every time by hand?  Would it be in the spirit of how
startup configuration works in YDL to add something like the following
to /etc/rc.d/rc.sysinit (just before the line that runs hwclock):

if [ -x /sbin/adjtimex ]; then
  [ -n "$TICK" ] && ADJTIMEXFLAGS="$ADJTIMEXFLAGS -t $TICK"
  [ -n "$FREQ" ] && ADJTIMEXFLAGS="$ADJTIMEXFLAGS -f $FREQ"
  [ -n "$ADJTIMEXFLAGS" ] && /sbin/adjtimex $ADJTIMEXFLAGS
fi

and then specify TICK=10003 and FREQ=whatever in /etc/sysconfig/clock?
Or would that be asking for trouble by breaking other programs'
assumptions about the contents of the config file?

If I instead use ntp to synchronize with a time server, does it still
make sense to set the tick and frequency at startup as a "head start",
or does ntpd maintain this information between sessions?

Thanks,
Ray