During this season of giving, you can show your support for the NTP Project by making a donation to Network Time Foundation.
REFACTOR See HowToCalibrateSystemClockUsingNTPDev for discussion of this topic.

How to calibrate the system clock using NTP

If you have a NTP daemon running and configured for a reliable time server, NTP will discipline your system clock. If you do not want to run NTP continuously, but rather calibrate your system clock once, NTP can help you to find the frequency offset of your system clock.

Linux / Unix

There are several methods to measure your system clock's frequency offset using NTP. These include David's recipes from his posting: https://groups.google.com/group/comp.protocols.time.ntp/msg/a08569bcf7b1a704.

Plan A: let NTP daemon determine the clock skew.

Run the NTP daemon using a reliable time server. The daemon will then measure and record the intrinsic clock frequency offset in the so called frequency file ntp.drift. Depending on the computer clock oscillator's frequency error this may take some hours (or even days) to stabilize. When the value has converged, the frequency file contains the frequency offset measured in parts-per-million (PPM).

David's recipe:
  1. Run ntptime -f 0 to remove any leftover kernel bias.
  2. Configure for a reliable server over a quiet network link.
  3. Remove the frequency file ntp.drift.
  4. Start the daemon and wait for at least 15 minutes until ntpq -c rv shows state=4. Record the frequency offset (the value after frequency=). It should be within 1 PPM of the actual frequency offset. For enhanced confidence, wait until the first frequency file update after one hour or so.

Plan B: calculate skew as first derivative of offset against time

You can also measure the time offset to a reliable time server. The offset plotted against time should give a straight line; the slope is the time offset per second.

David's recipe:
  1. Run ntptime -f 0 to remove any leftover kernel bias.
  2. Delete the frequency file ntp.drift otherwise NTP daemon will sets clock adjustment parameters and you end up measuring the residual error.
  3. Configure for a reliable server over a quiet network link.
  4. Start the daemon with disable ntp in the configuration file (see misc. configuration options).
  5. Find the assID of your peer using ntpq -c assoc and write it down.
  6. Using ntpq -c 'rv assId', record the offset (the value after offset=) over a period of hours.
  7. Do a least-squares fit; the regression line slope is the frequency.

Plan C: same as B but from remote.

If you want to remotely measure the time offset, resort to ntpdate.

Run the NTP daemon configured for the pseudo-reference local clock ( as server. Execute ntpdate -q on a synchronized system against the system you want to measure. ntpdate will output the time offset in seconds. If you record the offset (and time) periodically, you can fit a straight line to the data points. The slope times 86400 will give the estimated offset in seconds per day. This can be converted into PPM. Measuring for one hour will be enough to get a reasonably accurate value.

Hint: The official distribution will be DeprecatingNtpdate soon.

Instead of ntpdate, you can also use the sntp program distributed with the NTP software.

More Information


Linux uses David L. Mills' clock adjustment algorithm. The system call adjtimex reads and optionally sets adjustment parameters (e.g. frequency offset) for this algorithm. To read or set the current kernel parameters use the ntptime utility program included in the NTP distribution. more

The ntpq utility program is used to monitor NTP daemon ntpd operations and determine performance. more

ntpdate sets the local date and time by polling the Network Time Protocol (NTP) server(s) given as the server arguments to determine the correct time. more


100 PPM = 8.64 seconds / day


Recommended readings:

-- DanielKabs - 6 Mar 2006


Please use HowToCalibrateSystemClockUsingNTPDev for comments about HowToCalibrateSystemClockUsingNTP.
Topic revision: r13 - 05 Oct 2022, DruLavigne
Copyright © by the contributing authors.Use of this website indicates your agreement with, and acceptance of, the PrivacyPolicy, the WikiDisclaimer, and the PrivateWebPolicy.