Timer issues

Matthew Dillon dillon at apollo.backplane.com
Fri Nov 18 10:29:30 PST 2005


:I have also had trouble keeping my clock in sync with the system(OpenBSD) ntpd included in 1.2.  I think that if your clock is toofast or slow, you are simply out of luck.  Matt wrote a smarterreplacement called dntpd which should be in 1.4, but for now, thenet/ntp4 in pkgsrc should work fine.
:To start it at boot time, you will need the following...
:/etc/rc.conf:ntpd_flags=""ntpd_program="/usr/pkg/bin/ntpd"
:/etc/ntp.conf:server pool.ntp.orgpidfile /var/run/ntpd.piddriftfile /var/db/ntp.drift
:
:Chris

    OpenBSD's ntpd is really unusable.  It isn't so much that the code is
    buggy, just that the author didn't know enough about statistical math
    algorithms to implement the correct algorithm.   It only does coarse
    time corrections and their does not try to compensate for drift that
    occurs during the data accumulation period.  It simply will not work
    if you have a clock that isn't already close to perfect.

    Use dntpd, let it run about a week, then report all dntpd logged events
    from /var/log/messages over that period.  dntpd uses two sets of 
    staggered continuously running math correllations, calculates offset
    and frequency drift separately, and only makes corrections when
    it determines that the data is beyond the noise floor of the 
    calculation.

    For example, here is the output from one of my boxes:

Nov 14 22:44:03 apollo dntpd[600]: issuing offset adjustment: -0.005805
Nov 15 09:07:32 apollo dntpd[600]: issuing offset adjustment: 0.004346
Nov 16 00:42:05 apollo dntpd[600]: issuing offset adjustment: -0.006872
Nov 16 00:59:20 apollo dntpd[600]: issuing offset adjustment: 0.002594
Nov 16 11:04:24 apollo dntpd[600]: issuing offset adjustment: 0.004221
Nov 16 15:12:51 apollo dntpd[607]: dntpd version 1.0 started
Nov 16 15:13:06 apollo dntpd[607]: issuing offset adjustment: 29.591125
Nov 16 15:23:56 apollo dntpd[607]: issuing frequency adjustment: -38.454ppm
Nov 16 18:43:54 apollo dntpd[607]: issuing offset adjustment: -0.025487
Nov 17 05:03:23 apollo dntpd[607]: issuing offset adjustment: 0.001680
Nov 17 22:32:03 apollo dntpd[607]: issuing offset adjustment: -0.005154
Nov 18 07:16:04 apollo dntpd[607]: issuing offset adjustment: 0.004126
Nov 18 07:36:23 apollo dntpd[607]: issuing offset adjustment: 0.001795

    And here is the output from leaf:

Sep 13 10:56:20 leaf dntpd[7651]: dntpd version 1.0 started
Sep 13 10:56:36 leaf dntpd[7651]: issuing offset adjustment: 0.024496
Sep 13 11:07:22 leaf dntpd[7651]: issuing frequency adjustment: 12.834ppm
Sep 13 11:28:21 leaf dntpd[7651]: issuing offset adjustment: 0.008295
Sep 14 09:31:00 leaf dntpd[7651]: issuing offset adjustment: 0.002541
Sep 15 02:59:02 leaf dntpd[7651]: issuing offset adjustment: -0.006782
Sep 15 03:19:22 leaf dntpd[7651]: issuing offset adjustment: 0.003065
Sep 15 11:42:32 leaf dntpd[7651]: issuing offset adjustment: 0.003599
Sep 15 12:07:57 leaf dntpd[7651]: issuing offset adjustment: 0.001029
Sep 16 00:47:07 leaf dntpd[7651]: issuing offset adjustment: -0.016373
Sep 16 01:06:54 leaf dntpd[7651]: issuing offset adjustment: 0.003125
Sep 16 09:29:50 leaf dntpd[7651]: issuing offset adjustment: 0.007129
Sep 16 09:49:33 leaf dntpd[7651]: issuing offset adjustment: 0.003472
Sep 16 22:33:19 leaf dntpd[7651]: issuing offset adjustment: -0.011361
Sep 16 22:52:46 leaf dntpd[7651]: issuing offset adjustment: 0.003064
Sep 18 00:37:43 leaf dntpd[7651]: issuing offset adjustment: -0.018828
Sep 18 00:56:37 leaf dntpd[7651]: issuing offset adjustment: 0.002187
Sep 18 13:38:10 leaf dntpd[7651]: issuing offset adjustment: 0.016252
Sep 18 22:18:02 leaf dntpd[7651]: issuing offset adjustment: -0.018269
Sep 18 22:36:29 leaf dntpd[7651]: issuing offset adjustment: 0.004324
Sep 19 11:18:11 leaf dntpd[7651]: issuing offset adjustment: 0.014334
Sep 19 11:36:27 leaf dntpd[7651]: issuing offset adjustment: 0.002879
Sep 20 00:16:59 leaf dntpd[7651]: issuing offset adjustment: -0.028191
Sep 20 00:34:56 leaf dntpd[7651]: issuing offset adjustment: 0.008507
Sep 20 08:55:41 leaf dntpd[7651]: issuing offset adjustment: 0.019660
Sep 20 09:13:30 leaf dntpd[7651]: issuing offset adjustment: 0.003417
Sep 20 21:53:25 leaf dntpd[7651]: issuing offset adjustment: -0.014671
Sep 21 10:56:53 leaf dntpd[7651]: issuing offset adjustment: 0.009098
Sep 22 04:04:41 leaf dntpd[7651]: issuing offset adjustment: -0.007326
. ..

    It should be possible to determine whether your problem is 
    simply a badly drifting clock, or whether it is a wild clock.
    If it is simply a badly drifting clock dntpd will report a 
    frequency adjustment but then not have to make very many offset
    corrections after that, as is the case for both the machines above. 
    If the clock is going haywire, however, you will see a significant number
    of large offset corrections.

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>






More information about the Users mailing list