Subject: Re: netbsd clock problem...
To: Henry B. Hotz <hotz@jpl.nasa.gov>
From: Skeelo <skeelo@white-dwarf.dyn.ml.org>
List: port-mac68k
Date: 08/12/1998 00:14:46
Uh huh, I'd like to say that I'm using xntpd successfully. I've been doing
so for at least 8 months now ( ever since I was running 1.2.1 ) I've set
the NTP kernel option and while xntpd is not always synced it does keep
accurate time on my system to within a few seconds when I'm connected to
the net, and doesn't loose more than a few minutes when I'm not. Even if I
do something like compile the NetBSD source or make a new kernel.

While I will agree that the clock does loose time. I think ntp does a fine
job for me. Also I do run a ntpdate command every time I reconnect to the
net, but as I said before it is hardly more than a few minutes most of the
time.

Here are some of my files...

/etc/ppp/ip-up:
#!/bin/sh

killntpd() {
	if [ -f /var/run/xntpd.pid ]
	then
	  kill -TERM `cat /var/run/xntpd.pid`
	  rm -f /var/run/xntpd.pid
	fi
	
	return 0
}

	killntpd
	ntpdate ntp2.usno.navy.mil
	sleep 5
	xntpd -p /var/run/xntpd.pid
EOF

/etc/ntp.conf:
server ntp2.usno.navy.mil
server ntp-2.vt.edu
server louie.udel.edu
server xfiles-jr.esa.lanl.gov

driftfile /etc/ntp.drift
logfile /var/log/ntp/xntpd.log
statsdir /usr/local/ntp/stats
keys /etc/ntp.keys
EOF

# I started this file at 500 and let xntpd figure it out from there.
/etc/ntp.drift:
407.018
EOF

/sys/arch/mac68k/conf/GNOME: (relevant options from my config)
options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
options 	NTP		# NTP phase/frequency locked loop
EOF

/var/log/ntp/xntpd.log:
[Most synchronized lines were snipped. There were lots of them.]
 9 Aug 02:28:33 xntpd[20780]: signal_no_reset: signal 20 had flags 2
 9 Aug 02:35:33 xntpd[20780]: synchronized
 9 Aug 02:35:35 xntpd[20780]: time reset (step) 2.094517 s
 9 Aug 02:35:35 xntpd[20780]: synchronisation lost
 9 Aug 02:39:53 xntpd[20780]: synchronized
 9 Aug 02:39:54 xntpd[20780]: time reset (step) 0.761077 s
 9 Aug 02:39:54 xntpd[20780]: synchronisation lost
 9 Aug 02:44:10 xntpd[20780]: synchronized
 9 Aug 03:04:20 xntpd[20780]: time reset (step) 1.612571 s
 9 Aug 03:04:20 xntpd[20780]: synchronized
 9 Aug 03:04:20 xntpd[20780]: synchronisation lost
 9 Aug 03:08:38 xntpd[20780]: synchronized
 9 Aug 04:38:22 xntpd[20780]: time reset (step) -0.372978 s
 9 Aug 04:38:22 xntpd[20780]: synchronized
 9 Aug 04:38:22 xntpd[20780]: synchronisation lost
 9 Aug 04:42:42 xntpd[20780]: synchronized
 9 Aug 05:00:52 xntpd[20780]: time reset (step) -0.572317 s
 9 Aug 05:00:52 xntpd[20780]: synchronized
 9 Aug 05:00:52 xntpd[20780]: synchronisation lost
 9 Aug 05:05:10 xntpd[20780]: synchronized
 9 Aug 05:23:19 xntpd[20780]: time reset (step) -0.481207 s
 9 Aug 05:23:19 xntpd[20780]: synchronized
 9 Aug 05:23:19 xntpd[20780]: synchronisation lost
 9 Aug 05:27:44 xntpd[20780]: synchronized
 9 Aug 05:47:39 xntpd[20780]: time reset (step) -0.617298 s
 9 Aug 05:47:39 xntpd[20780]: synchronized
 9 Aug 05:47:39 xntpd[20780]: synchronisation lost
 9 Aug 06:07:55 xntpd[20780]: time reset (step) -0.357019 s
 9 Aug 06:07:55 xntpd[20780]: synchronisation lost
 9 Aug 06:32:48 xntpd[20780]: time reset (step) -0.461574 s
 9 Aug 06:32:49 xntpd[20780]: synchronisation lost
 9 Aug 06:53:15 xntpd[20780]: time reset (step) -0.349397 s
 9 Aug 06:53:15 xntpd[20780]: synchronisation lost
 9 Aug 07:17:57 xntpd[20780]: time reset (step) -0.337938 s
 9 Aug 07:17:57 xntpd[20780]: synchronisation lost
 9 Aug 07:49:20 xntpd[20780]: time reset (step) -0.399886 s
 9 Aug 07:49:20 xntpd[20780]: synchronisation lost
 9 Aug 08:22:21 xntpd[20780]: time reset (step) -0.325982 s
 9 Aug 08:22:21 xntpd[20780]: synchronisation lost
 9 Aug 08:43:06 xntpd[20780]: time reset (step) -0.419611 s
 9 Aug 08:43:07 xntpd[20780]: synchronisation lost
 9 Aug 09:04:05 xntpd[20780]: time reset (step) -0.285266 s
 9 Aug 09:04:05 xntpd[20780]: synchronisation lost
 9 Aug 09:25:02 xntpd[20780]: time reset (step) -0.416886 s
 9 Aug 09:25:02 xntpd[20780]: synchronisation lost
 9 Aug 09:50:28 xntpd[20780]: time reset (step) -0.252793 s
 9 Aug 09:50:28 xntpd[20780]: synchronisation lost
 9 Aug 10:13:37 xntpd[20780]: time reset (step) 0.208854 s
 9 Aug 10:13:37 xntpd[20780]: synchronisation lost
 9 Aug 10:39:36 xntpd[20780]: time reset (step) 0.359119 s
 9 Aug 10:39:36 xntpd[20780]: synchronisation lost
 9 Aug 11:01:27 xntpd[20780]: time reset (step) -0.387238 s
 9 Aug 11:01:27 xntpd[20780]: synchronisation lost
 9 Aug 11:29:37 xntpd[20780]: time reset (step) -0.274267 s
 9 Aug 11:29:37 xntpd[20780]: synchronisation lost
 9 Aug 11:58:57 xntpd[20780]: time reset (step) -0.255451 s
 9 Aug 11:58:57 xntpd[20780]: synchronisation lost
 9 Aug 12:21:32 xntpd[20780]: time reset (step) -0.406508 s
 9 Aug 12:21:32 xntpd[20780]: synchronisation lost
 9 Aug 12:49:57 xntpd[20780]: time reset (step) -0.330259 s
 9 Aug 12:49:57 xntpd[20780]: synchronisation lost
 9 Aug 13:42:22 xntpd[20780]: time reset (step) 1.097671 s
 9 Aug 13:42:22 xntpd[20780]: synchronisation lost
 9 Aug 14:56:07 xntpd[20780]: time reset (step) 1.418924 s
 9 Aug 14:56:07 xntpd[20780]: synchronisation lost
 9 Aug 15:17:46 xntpd[20780]: time reset (step) -0.301975 s
 9 Aug 15:17:46 xntpd[20780]: synchronisation lost
 9 Aug 15:42:03 xntpd[20780]: time reset (step) -0.217589 s
 9 Aug 15:42:03 xntpd[20780]: synchronisation lost
 9 Aug 16:03:47 xntpd[20780]: time reset (step) -0.256304 s
 9 Aug 16:03:47 xntpd[20780]: synchronisation lost
 9 Aug 16:27:45 xntpd[20780]: time reset (step) -0.315517 s
 9 Aug 16:27:45 xntpd[20780]: synchronisation lost
 9 Aug 17:03:58 xntpd[20780]: time reset (step) 2.809032 s
 9 Aug 17:03:58 xntpd[20780]: synchronisation lost
 9 Aug 17:08:24 xntpd[20780]: time reset (step) 0.620080 s
 9 Aug 17:08:24 xntpd[20780]: synchronisation lost
 9 Aug 17:13:56 xntpd[20780]: time reset (step) 0.827351 s
 9 Aug 17:13:56 xntpd[20780]: synchronisation lost
 9 Aug 17:38:38 xntpd[20780]: time reset (step) 4.012964 s
 9 Aug 17:38:38 xntpd[20780]: synchronisation lost
 9 Aug 18:23:16 xntpd[20780]: time reset (step) -0.258022 s
 9 Aug 18:23:16 xntpd[20780]: synchronisation lost
 9 Aug 18:44:06 xntpd[20780]: time reset (step) 0.651047 s
 9 Aug 18:44:06 xntpd[20780]: synchronisation lost
 9 Aug 20:20:26 xntpd[20780]: synchronisation lost
 9 Aug 20:24:10 xntpd[20780]: synchronisation lost
 9 Aug 20:25:52 xntpd[20780]: time reset (step) 8.864482 s
 9 Aug 20:25:52 xntpd[20780]: synchronisation lost
 9 Aug 20:51:41 xntpd[20780]: time reset (step) 1.980174 s
 9 Aug 20:51:41 xntpd[20780]: synchronisation lost
 9 Aug 21:19:45 xntpd[20780]: time reset (step) 2.579141 s
 9 Aug 21:19:46 xntpd[20780]: synchronisation lost
 9 Aug 21:26:20 xntpd[20780]: time reset (step) 2.573222 s
 9 Aug 21:26:20 xntpd[20780]: synchronisation lost
 9 Aug 21:31:50 xntpd[20780]: time reset (step) 1.551215 s
 9 Aug 21:31:50 xntpd[20780]: synchronisation lost
 9 Aug 21:52:50 xntpd[20780]: time reset (step) 2.270725 s
 9 Aug 21:52:50 xntpd[20780]: synchronisation lost
 9 Aug 21:57:09 xntpd[20780]: time reset (step) 0.637487 s
 9 Aug 21:57:09 xntpd[20780]: synchronisation lost
 9 Aug 22:18:02 xntpd[20780]: time reset (step) 6.338276 s
 9 Aug 22:18:02 xntpd[20780]: synchronisation lost
 9 Aug 22:23:24 xntpd[20780]: time reset (step) 0.848335 s
 9 Aug 22:23:24 xntpd[20780]: synchronisation lost
 9 Aug 22:28:57 xntpd[20780]: time reset (step) 1.217406 s
 9 Aug 22:28:57 xntpd[20780]: synchronisation lost
 9 Aug 22:34:04 xntpd[20780]: time reset (step) 1.142005 s
 9 Aug 22:34:04 xntpd[20780]: synchronisation lost
 9 Aug 22:40:29 xntpd[20780]: time reset (step) 0.654418 s
 9 Aug 22:40:29 xntpd[20780]: synchronisation lost
 9 Aug 22:45:51 xntpd[20780]: time reset (step) 1.968885 s
 9 Aug 22:45:51 xntpd[20780]: synchronisation lost
 9 Aug 22:50:20 xntpd[20780]: time reset (step) 0.671059 s
 9 Aug 22:50:20 xntpd[20780]: synchronisation lost
 9 Aug 22:58:49 xntpd[20780]: synchronized
EOF

On Tue, 11 Aug 1998, Henry B. Hotz wrote:

> At 1:57 PM -0700 8/11/98, Capt. Avram Dorfman wrote:
> >Is there any better info out there about dealing w/ the clock problem,
> >besides what's in the macbsd.com FAQ?
> 
> I haven't read the FAQ in a while, but I did look into this problem.
> 
> The reason the Mac keeps lousy time is that the hardware interrupt
> priorities are set according to some strange philosophy of importance that
> does not correspond to good system design.  The user is the most important
> thing so the mouse gets highest priority.  OS housekeeping is unrelated to
> serving the user so the clock gets the lowest priority.  Therefore if
> *anything*at*all* is happening in the kernel due to an interrupt of any
> kind the clock interrupt is locked out and you loose time.
> 
> I was told by Johnathan Stone (who had something to do with the relevant
> code) that the situation might improve if you used the FLL instead of the
> PLL or hybred FLL/PLL that is the default.  I don't know how to do this.
> There is a flag that the kernel souce checks to determine which mode to
> use, but I don't know how to get it set.  Do you do an
> options	NTP=<flag>
> in the kernel config, or what?
> 
> Anyway the bottom line is that you can't run ntp.  All the machinery is
> there, but if you turn it on the loop never stabilizes to the point where
> it will start adjusting the local clock.  That's the *official* explanation
> anyway.  It also never gives you a meaningful error message in the syslog
> until several days later, which bugs me a bit.  If you don't specifically
> look at the loop parameters or check timestamps you think everything is
> working for quite a while before it becomes obvious.
> 
> In short I *could* tell you how to set up the /etc/ntp.conf file, but
> there's no point.  Just do what everybody else does (including me) and put
> ntpdate in a cron job.  There's even a /etc/rc.conf option to do this for
> you.
> 
> Sorry to bear bad news.
> 
> Signature failed Preliminary Design Review.
> Feasibility of a new signature is currently being evaluated.
> h.b.hotz@jpl.nasa.gov, or hbhotz@oxy.edu
> 
>