ntpd drifted away

Kurt Wall kwall
Mon May 17 12:00:44 PDT 2004


In a 1.1K blaze of typing glory, Joel Hammer wrote:
> I run ntpd on my linux boxes, using my firewall machine and
> LOCAL as their only time server. The firewall synchronizes
> to internet time servers.
> 
> I noticed today that one of my two clients was 20
> secs fast. ntpd was running. I ran ntp-update, which
> synchronized my client with the firewall time server
> properly.
> 
> The question: What could cause ntpd to be that far off?
> The hardware clock is only a couple of seconds off, and
> this box has been up for four days. Are there log files
> which would tell me the answer?

/var/log/<something> if NTP is logging to its own file or
/var/log/messages (in the standard case) if NTP is using
syslogd:

# grep ntpd /var/log/messages
Mar 18 03:10:48 luther ntpd[438]: ntpd 4.1.2 at 1.892 Thu Sep 11 23:47:04 PDT 2003 (1)
Mar 18 03:10:48 luther ntpd[438]: precision = 13 usec
Mar 18 03:10:48 luther ntpd[438]: kernel time discipline status 0040
Mar 18 03:10:48 luther ntpd[438]: frequency initialized -37.819 from /etc/ntp/drift
Mar 18 19:12:03 luther ntpd[438]: ntpd 4.1.2 at 1.892 Thu Sep 11 23:47:04 PDT 2003 (1)
Mar 18 19:12:03 luther ntpd[438]: precision = 13 usec
Mar 18 19:12:03 luther ntpd[438]: kernel time discipline status 0040
Mar 18 19:12:03 luther ntpd[438]: frequency initialized -23.982 from /etc/ntp/drift
Mar 18 19:30:46 luther ntpd[438]: time reset -0.723247 s
Mar 18 19:30:46 luther ntpd[438]: synchronisation lost

> The only difference between my two linux clients is that
> the bad client DOESN'T automatically run hwclock --systohc
> every hour. (I just changed that.)

If you're using NTP, *don't* use hwclock except at boot time.
Read the hwclock manual page to understand why. Basically, NTP keeps
better time than the hardware clock.

> My second question,
> 1. After running hwclock --systohc
> I get this when I run hwclock --show:
> 
>      Thu Mar 18 21:31:20 2004  -0.522562 seconds
> 
> What is the last number for? It changes with each hwclock --show
> command.

The fractional number of seconds of the difference between the hardware 
clock (21:31:20) and the kernel's clock. The kernel's clock is more
accurate, because it is driven by a timer interrupt, which is considerably 
more fine-grained than /dev/rtc, which is the (standard) interface to
the hardware clock.

Kurt
-- 
It is impossible to travel faster than light, and certainly not
desirable, as one's hat keeps blowing off.
		-- Woody Allen



More information about the Linux-users mailing list