clock adjustment for drift

Berkem Dincman berkemdin at
Sun Mar 31 04:29:38 PST 2002

while I got curious whether the system time would automatically switch 
to summertime, I encountered a nice feature of hwclock, that could 
account for the time drift of the hardware clock. According to the 
manual, one can manually set the hardware clock with

hwclock --set --utc --date="3/31/02 15:41:00"

This will also change the value of the shell variable UTC in


if it hadn't been set before. Now hardware clock is set, which doesn't 
change the sytem time yet, therefore you type

hwclock -s

After one day or so, you set your time again with the same accurate 
source (for instance TV Teletext), meanwhile hwclock recorded 
automatically the drift between these two time instances and wrote it to


where the first number in the file is the amount of seconds per day in 
the observed drift of the hwclock. Now if you want your system to adjust 
around this number every time you boot up, you can add a line

/sbin/hwclock -a


/sbin/hwclock $CLOCKPARAMS in


I haven't tried it myself yet, but I guess 5 to 6 sec per day is the 
drift on my '98 machine, and after I got that, I'll put that line into 
the mentioned file and observe.

Berkem Dinçman
P.S.:will this post be readable by the world?

Unsubscribe: send email to listar at
and put 'unsubscribe hints' in the subject header of the message

More information about the hints mailing list