*BSD News Article 72691


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.mel.connect.com.au!news.syd.connect.com.au!gidora.zeta.org.au!not-for-mail
From: bde@zeta.org.au (Bruce Evans)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Adjusting for timer inaccuracies in the kernel
Date: 3 Jul 1996 20:13:25 +1000
Organization: Kralizec Dialup Unix
Lines: 31
Message-ID: <4rdh45$n0g@godzilla.zeta.org.au>
References: <4rcnm6$cht@emerald.silicon.net>
NNTP-Posting-Host: godzilla.zeta.org.au

In article <4rcnm6$cht@emerald.silicon.net>,
Christopher Ellwood <chris@Silicon.NET> wrote:
>The clock on one of my FreeBSD machines consistently gains about 147 seconds
>a week.  This works out to be a gain of a little less than 1 second per hour.
>Naturally, I could run xntpd on this machine and have it constantly adjust
>the time, but I would need dedicated access to an accurate ntp server.
>Instead, I would like to make an adjustment in the kernel to compensate for
>the significant inaccuracies in my system's clock.  Is there a simple kernel
>constant that I can adjust to do this (and if so, how much should I adjust
>it by), or does making such a correction in the kernel require more than a
>simple adjustment?

There is a simple constant: TIMER_FREQ.  Increase this to slow down the
system clock.  Expect to reduce the drift to less than 1 part in 20000
(less than 1/6 second per hour).

You can also use xntpd without an accurate ntp server.  Just put a
correction for the drift in the ntp drift file.  If /etc/ntp.conf is
nonexistent and xntpd isn't started by default, this is easy to test
using comannds like:

	echo "12.000 1" >/etc/ntp.drift
	xntpd
	sleep 10; killall xntpd		# no need to keep xntpd running

12.000 is the drift in parts per million (except for a factor of 1.024).
`1' says to user the kernel PLL.

This can be used without adjusting TIMER_FREQ if the drift is small.
-- 
Bruce Evans  bde@zeta.org.au