clock adjustment for drift

Bruce Dubbs bdubbs at swbell.net
Sun Mar 31 09:43:58 PST 2002


Berkem Dincman wrote:
> Hi,
> 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
> 
> /etc/sysconfig/clock
> 
> 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
> 
> /var/lib/hwclock/adjtime
> 
> 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
> 
> before
> 
> /sbin/hwclock $CLOCKPARAMS in
> 
> /etc/init.d/setclock
> 
> 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.

If you have a continuous internet connection like dsl or cable, take a 
look at ntp (network time protocol).  My system is generally accurate to 
within 2ms all the time.
   -- Bruce

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



More information about the hints mailing list