How NTP Disciplines the Time (Computer Network Time Synchronization)

Every NTP host has a hardware system clock, usually implemented as a counter driven by a quartz crystal or surface acoustic wave (SAW) oscillator. The counter interrupts the processor at intervals of 10 ms or so and advances the software system clock by this interval. The software clock can be read by application programs using a suitable application program interface (API) to determine the current clock time. In some architectures, software time values can be interpolated between interrupts using a processor chip counter called the processor cycle counter (PCC) in Digital systems and the timestamp counter (TSC) in Intel systems. In most computers today, several application programs can be running at once, and each can read the clock without interference from other programs. Precautions are necessary to avoid violating causality; that is, the clock reading operation is always atomic and monotone-definite increasing.

In Unix operating systems of today, the system clock is represented in seconds and microseconds or nanoseconds with a base epoch of 0 h 1 January 1970. The Unix system clock can be set to run at a nominal rate and at two other rates slightly fast and slightly slow by 500 PPM or 0.5 ms/s. A time adjustment is performed by calculating the length of an interval to run the clock fast or slow to complete the specified adjustment. Unix systems include the capability to set the clock to an arbitrary time, but NTP does this only in exceptional circumstances.

No computer clock is perfect; the intrinsic frequency can vary from computer to computer and even from time to time. In particular, the frequency error can be as large as several hundred parts per million, depending on the manufacturing tolerance. For instance, if the frequency error is 100 PPM and no corrective means are available, the time error will accumulate at the rate of about 8 s per day. In addition, the frequency can fluctuate depending on the ambient temperature, associated circuit components, and power supply variations. The most important contribution to frequency fluctuations is the ambient temperature. A typical temperature coefficient is 1 PPM per degree celsius.

Thus, in the example after 1 s the time error will be 100 jus, which is generally considered good timekeeping on a local-area network (LAN).By way of comparison, a modern workstation with kernel timekeeping support can attain nominal accuracy in the low microseconds.

Each computer clock can have a different intrinsic frequency and different frequency fluctuations with temperature. This can be a valuable diagnostic aid; the intrinsic frequency can serve as something like a unique fingerprint which identifies a particular computer. More usefully, the fluctuation with temperature can be recorded and used as a machine room or motherboard thermometer. In fact, failures in room air conditioning and central processing unit (CPU) fans have been alarmed in this way. In passing, an NTP frequency surge has often been the first indication that a power supply fan, CPU fan, or air conditioner is failing.*

Next post:

Previous post: