[ntp:questions] HowTo calibrate system clock frequency using NTP

Daniel Kabs daniel.kabs at gmx.de
Fri Jan 27 16:35:32 UTC 2006


I like to measure the system clock drift and use the resulting value to 
correct the system clock using the "adjtimex" tool (-t and -f option).

I can think of at least two ways to measure the drift and I'd like to 
ask you whether this is the correct way to do it.

Plan A)

Run ntpd using a reliable time server. ntpd will measure and record the 
intrinsic clock frequency offset in the so called "drift file".

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 "drift file" contains the frequency offset measured in 
parts-per-million (PPM).

Plan B)

Run ntpd using local clock ( as server. Execute "ntpdate -q"
on a synchronized system against the system you want to measure. ntpdate 
will output the precise time offset in seconds. If you record the offset 
(and time) periodically, you can fit a straight line to the data points. 
The slope * 86400 will give the estimated offset in seconds per day. 
This can be converte into ppm (100 ppm == 8.64 sec/day). Measuring for 
one hour will be enough to get a reasonable accurate value.

Now use adjtimex to correct the system clock for systematic drift as 
described in the example of the man page.

I tried B) and will now run plan A) over the weekend to record a drift 
file. I hope this will give a similar result.

Refactor, don't archive! - SamHasler - 28 Aug 2004 - twiki.org

More information about the questions mailing list