REFACTOR See AdjustingRadioclocksDev for discussion of this topic.

Adjusting Radio clocks

Radioclocks must be adjusted to compensate for the timecodes to be transmitted from the sender to the radio clock. A simple approach is to measure the distance to the sender and the add 1 ms delay for each 300 km. A better way is to use statistics gathered by ntpd.

Configuring the clock before adjustment

The radio clock has to be configured in a special way to make the statistics useful. Some clocks have a default value for time1 which is not zero so that should be set to 0. The clock is not supposed to be used before adjustment so it should be marked with noselect.

server 127.127.x.y noselect
fudge 127.127.x.y time1 0

Configuring statistics

There are different kinds of statistics available. The one needed in this case is peer stats. To activate it the following must be set in ntp.conf:

statistics peerstats
statdir /var/log/ntp/stats/
filegen peerstats type day file peers enable

This makes ntpd generate one file of peer statistics a day. Note the trailing / in the statdir-definition.

Using the statistics to find the adjustment

The script peer.awk included with ntpd can be used to find the adjustment. The script lists statistics for each configured server and clock. An example:

$ LANG=C awk -f peer.awk /var/log/ntp/stats/peers.*

       ident     cnt     mean     rms      max     delay     dist     disp
==========================================================================       98   -1.487    1.091    2.642    0.000    0.000    0.000   84    0.907    0.414    1.051    8.953  943.384   25.527   84    0.770    0.435    1.085    8.658  942.140   25.586      84    0.702    0.398    0.952   27.279  951.166   25.686      85    0.711    0.490    1.253   27.546  952.638   25.082

After a while the means for the servers will be close to 0.000 and the mean for the clock can be used as a good value for time1. The mean will show up as negative because the clock lacks the adjustment. Note that the mean is in ms but the value for time1 is in seconds. LANG=C makes sure that the script works even for locales with , as the decimal point.

-- RuneMagnussen - 11 Apr 2007

This topic: Support > WebHome > ConfiguringNTP > ConfiguringRefclocks > AdjustingRadioclocks
Topic revision: r1 - 2007-04-11 - 19:18:06 - RuneMagnussen
SSL security by CAcert
Get the CAcert Root Certificate
This site is powered by the TWiki collaboration platform
IPv6 Ready
Copyright & 1999-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors. Ideas, requests, problems regarding the site? Send feedback