r11 - 2006-03-20 - 16:52:00 - DanielKabsYou are here: NTP >  Support Web > HowToCalibrateSystemClockUsingNTP
NTP users are strongly urged to take immediate action to ensure that their NTP daemons are not susceptible to being used in distributed denial-of-service (DDoS) attacks. Please also take this opportunity to defeat denial-of-service attacks by implementing Ingress and Egress filtering through BCP38.

ntp-4.2.8p10 was released on 21 March 2017. It addresses 6 medium- and 5 low-severity security issues, 4 informational security topics, 15 bugfixes, and contains other improvements over 4.2.8p9.

Please see the NTP Security Notice for vulnerability and mitigation details.

Are you using Autokey in production? If so, please contact Harlan - he's got some questions for you.
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 recipees from his posting in newsgroup comp.protocols.time.ntp: drdqa5$o0g$1@dewey.udel.edu.

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.

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r11 < r10 < r9 < r8 < r7 | More topic actions
SSL security by CAcert
Get the CAcert Root Certificate
This site is powered by the TWiki collaboration platform
IPv6 Ready
Copyright & 1999-2017 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