Computer Clocks

Most computers include a quartz or surface acoustic wave (SAW) resonator-stabilized oscillator and oscillator counter that interrupt the processor at intervals of a few milliseconds, called the tick. At each tick interrupt, this value is added to a system variable representing the clock time. The clock can be read by system and application programs and set on occasion to an external reference. Once set, the clock readings increment at a nominal rate, depending on the value of the tick. Typical Unix system kernels provide a programmable mechanism to increase or decrease the value of the tick by a small, fixed amount to amortize a given time adjustment smoothly over multiple ticks. Think of this as how Big Ben timekeepers in London adjust the clock time by periodically placing and removing coinage on its pendulum. Very likely the last farthings, halfpennies, and tuppence, no longer in circulation, are in the Big Ben toolbox.

Clock errors are due to systematic variations in network delay and latencies in computer hardware and software (jitter) as well as clock oscillator wander. The time of a computer clock relative to ideal time can be expressed as

tmp91_thumb


where t is the current time, t0 is the time at the last measurement update, T is the time offset, R is the frequency offset, D is the drift due to resonator aging.The first three terms include systematic offsets that can be corrected and the last random variations that cannot. Some protocols, including DTSS, estimate only the first term in this expression, while others, including NTP, estimate the first two terms. Errors due to the third term, while important to model resonator aging in precision quartz oscillators, are usually dominated by errors in the first two terms.


The synchronization protocol estimates T (and R, where relevant) at regular update intervals and adjusts the clock to minimize T(t) in future t. In common cases, R can have nominal values up to several hundred parts per million with random variations in the order of 1 PPM due to ambient temperature changes. If R is neglected, the resulting errors can accumulate to seconds per day. Analysis of quartz-resonator-stabilized oscillators shows that residual errors due to oscillator wander are a function of the averaging time, which in turn depends on the update time. With update times less than about 15 min, errors are usually dominated by network jitter, while at intervals greater than this, errors are usually dominated by oscillator wander.

As a practical matter, for nominal accuracies on the order of a millisecond, this requires clients to exchange messages with servers at intervals of not more than about 15 min. However, if the accuracy requirement can be relaxed to a few tens of milliseconds, the update time can be increased to a day and a half.This allows real-time applications to adjust audio or video play-out delay, for example.

Next post:

Previous post: