On Mon, 26 Mar 2007, Luca Corti wrote:

> On Sun, 2007-03-25 at 14:26 -0700, Darrin Chandler wrote:
> > Have you measured the time from ntpd startup until it logs `clock is now
> > synced' in the log? On the same machine, I see anywhere from 10 minutes
> > to about 1 hour. In normal cases, machines acting as time servers are
> > always on. If it takes less than an hour for ntpd to sync, and then it's
> > up for months at a time then there's little problem.
> 
> I left OpenNTPd running over the weekend and it wasn't synced this
> morning. Today I've manually changed time 30 minutes in the past and
> then run ntpd -s. Now It seems to report it is synced to the clients.
> 
> 
> > If you want to turn on a computer and have it fetch some times from the
> > network and report that it's synced... well, that's not accurate. A big,
> > full-blown, complex thing like xntpd won't do it, either.
> > If you don't really care what time it is, but want all your local
> > computers to have the same time (or very, very close) there are other
> > ways such as timed(8). Then you can have a computer using ntpd, and
> > synced or not it can be a timed master for your network.
> 
> No, I'd like the clock to be synced and as accurate as possible. But not
> being able to sync at all is quite bad.

Could you run put the clock ahead 5min and run again with ntpd -d,
(don't forget to kill any existing ntpd process), let it run for some
hours, saving the log. Then apply the diff below and repeat. Then send
me both logs. The diff fixes a potential problem that won't surface on
OpenBSD, but might on other systems. 

        -Otto

Index: util.c
===================================================================
RCS file: /cvs/src/usr.sbin/ntpd/util.c,v
retrieving revision 1.12
diff -u -p -r1.12 util.c
--- util.c      27 Oct 2006 12:22:41 -0000      1.12
+++ util.c      26 Mar 2007 07:53:43 -0000
@@ -64,6 +64,10 @@ d_to_tv(double d, struct timeval *tv)
 {
        tv->tv_sec = (long)d;
        tv->tv_usec = (d - tv->tv_sec) * 1000000;
+       while (tv->tv_usec < 0) {
+               tv->tv_usec += 1000000;
+               tv->tv_sec -= 1;
+       }
 }
 
 double

Reply via email to