Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 May 2008 21:30:42 +0200
From:      Volker Jahns <volker@thalreit.de>
To:        Bruce Cran <bruce@cran.org.uk>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: time drift
Message-ID:  <482DE0E2.8020101@thalreit.de>
In-Reply-To: <482D549F.9050300@thalreit.de>
References:  <20080515185758.GA12709@ikarus.thalreit>	<597571FB-C72D-4603-B379-A59A435843BE@mac.com>	<20080515195302.GA13531@ikarus.thalreit>	<20080515203728.GA14284@ikarus.thalreit>	<482CA8EE.7040906@cran.org.uk> <482D549F.9050300@thalreit.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Volker Jahns wrote:
> Bruce Cran wrote:
>> Volker Jahns wrote:
>>> On Thu, May 15, 2008 at 09:53:02PM +0200, Volker Jahns wrote:
>>>> On Thu, May 15, 2008 at 12:18:57PM -0700, Chuck Swiger wrote:
>>>>> On May 15, 2008, at 11:57 AM, Volker Jahns wrote:
>>>>>> FreeBSD 6.2 running on X86 hardware (FSC) shows a remarkable 
>>>>>> time  drift
>>>>>>
>>>>>> running ntpdate every half hour shows that the system looses 
>>>>>> about  10-14 sec each time.
>>>>>> 15 May 10:06:48 ntpdate[7200]: step time server 192.53.103.108  
>>>>>> offset -13.799602 sec
>>>>>> 15 May 10:36:48 ntpdate[7515]: step time server 192.53.103.108  
>>>>>> offset -12.813941 sec
>>>>>> 15 May 11:06:48 ntpdate[7879]: step time server 192.53.103.108  
>>>>>> offset -13.651921 sec
>>>>>> 15 May 11:36:50 ntpdate[8079]: step time server 192.53.103.108  
>>>>>> offset -11.109298 sec
>>>>>> 15 May 12:06:50 ntpdate[8289]: step time server 192.53.103.108  
>>>>>> offset -11.836499 sec
>>>>> You should also take a look at the output of "sysctl  
>>>>> kern.timecounter", and possibly switch to a different mechanism, 
>>>>> if  the existing choice doesn't work out well for your machine...
>>>> Thanks for the hint.
>>> A few years ago a time drift problem had been observed by a German 
>>> freebsd
>>> user (http://www.freebsd.de/rachive/de-bsd-questions.200304/0643.html).
>>> Time drift 15 sec every half hour, ntpd dies away running on his 
>>> machine.
>>>     Setting kern.timecounter.hardware to TSC had been recommended as 
>>> a solution.
>>
>> There's also a FreeBSD PR open about this problem: 
>> http://www.freebsd.org/cgi/query-pr.cgi?pr=i386/123462
>>
>>
> sysctl -w kern.timecounter.hardware=TSC and then this:
> 16 May 08:37:01 ntpdate[28819]: adjust time server 192.53.103.108 
> offset -0.347027 sec
> 16 May 09:07:00 ntpdate[29258]: adjust time server 192.53.103.108 
> offset -0.313608 sec
> 16 May 09:37:00 ntpdate[29492]: adjust time server 192.53.103.108 
> offset -0.314357 sec
> 16 May 10:07:00 ntpdate[29826]: adjust time server 192.53.103.108 
> offset -0.313694 sec
>
>
> (Please note the use of ntpdate is for debugging purposes only, this 
> is _not_ an ntp issue)
>
Finally I want to come back to the time drift issue and howto improve 
it. Setting
kern.timecounter.hardware: i8254
machdep.i8254_freq: 1193182

16 May 12:07:01 ntpdate[31752]: adjust time server 192.53.103.108 offset 
-0.404453 sec
16 May 12:37:00 ntpdate[32425]: adjust time server 192.53.103.108 offset 
-0.396156 sec
16 May 13:07:01 ntpdate[32787]: adjust time server 192.53.103.108 offset 
-0.383712 sec
16 May 13:37:01 ntpdate[33126]: adjust time server 192.53.103.108 offset 
-0.387233 sec

Clock is too slow, frequency must be increased.
Corrected machdep.i8254_freq  from  1193182  to 1193448

16 May 17:37:00 ntpdate[36310]: adjust time server 192.53.103.108 offset 
-0.033320 sec
16 May 18:07:01 ntpdate[36632]: adjust time server 192.53.103.108 offset 
-0.053532 sec
16 May 18:37:00 ntpdate[37011]: adjust time server 192.53.103.108 offset 
-0.043264 sec
16 May 19:07:01 ntpdate[37361]: adjust time server 192.53.103.108 offset 
-0.055725 sec

Time drift is now only about 50 millisecs per half an hour.

-- 
Volker Jahns, volker@thalreit.de




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?482DE0E2.8020101>