Separate clock offset, drift, and synchronization evidence
Calculate a timestamp-exchange estimate while keeping clock-rate bounds, path asymmetry, and elapsed-time clocks distinct.
On this page
The question for today
What you’ll understand
- Distinguish offset from frequency error and clock resolution.
- Compute a four-timestamp offset and delay estimate with its symmetry assumption.
- Choose a local elapsed-time clock without treating it as a shared global epoch.
Two hosts can print equally precise timestamps and still disagree about when an event occurred. Their clocks may begin with different offsets, advance at slightly different rates, and receive corrections through paths with unequal delays. Distributed infrastructure needs explicit statements about each uncertainty. Start with a clock as a measured function of physical time, then ask what synchronization observations establish and what remains an assumption. More displayed decimal places do not answer those questions.
A clock is a rate as well as a reading
Write a clock reading as C(t), where t is ideal elapsed physical time for this model. Offset is C(t) minus t after choosing a common epoch; frequency error describes how quickly that difference changes. A clock can have excellent short-term stability but a large initial offset. Another can currently match the reference while drifting rapidly afterward. Resolution only describes distinguishable readings. None of these properties alone establishes an upper bound on error, and a small average error does not prove that every reading satisfies a safety-critical bound used by a protocol.
If the clock's rate remains between one minus rho and one plus rho, its error can grow by at most rho times elapsed physical time after the last trusted bound. This argument assumes uninterrupted rate control and an identified reference; a clock step, suspend behavior, virtual-machine pause, or faulty source can violate the model. Record how a deployed time service detects lost synchronization and how applications react when uncertainty expands. An implementation that silently keeps its former confidence interval after losing its reference has changed a correctness assumption without telling its callers.
An exchange estimates offset through a network
In a four-timestamp exchange, the client records send time t1 and receive time t4; the server records receive time t2 and send time t3. Subtract the server's processing interval from the client's round trip to estimate network delay. The familiar offset estimator splits that delay symmetrically between directions. If the server clock is ahead, the estimate is positive under this convention. Keep units and signs visible: confusing a client-minus-server offset with a server-minus-client correction can move an otherwise reasonable clock farther from its reference.
Symmetric one-way delay is an assumption, not something that four timestamps independently prove. Different outbound and return paths can bias the offset estimate even when measurements are repeatable. Selecting low-delay observations can reduce queueing noise without removing a persistent asymmetry. NTP also includes filtering, source selection, dispersion, and clock discipline beyond this one exchange. A production synchronization claim needs those mechanisms and their fault model, not just a short formula. In particular, a statistical statement that most measurements are close is weaker than a guarantee that real time lies inside every advertised interval.
Choose a clock for the property being measured
A wall clock is useful for human dates and correlations, but corrections can make it unsuitable for subtracting arbitrary readings to measure a local duration. A monotonic clock avoids discontinuous wall-time adjustments under its documented semantics. It is still local: its epoch is not generally meaningful on another host. Suspension and frequency discipline also matter; Linux exposes different clock choices with different behavior. Name the clock domain in measurements and persisted deadlines. After a reboot, a former monotonic reading is not automatically comparable with the new process's readings merely because both values are expressed in nanoseconds.
Repeated measurements can reduce random uncertainty without fixing a systematic path bias. The sampling lab makes that limited distinction concrete through an unrelated binary late-observation indicator. For each comparison, Reset, re-set both p and n, predict the sample-mean variance, then inspect or Step. Compare p=0.2 with n=20 and n=100 as separate configurations. The variance falls fivefold under the independent Bernoulli model, but this instrument does not estimate clock offset or calibrate a time source. Use that contrast to explain why more observations cannot, by themselves, establish a missing asymmetry bound.
Work it through
Interpret one timestamp exchange
A fictional exchange records client t1=100.000 s, server t2=100.012 s and t3=100.014 s, and client t4=100.010 s. Assume rate changes are negligible during the exchange. Calculate offset and network-delay estimates.
The client elapsed interval is 10 ms and the server processing interval is 2 ms, leaving an estimated round-trip path delay of 8 ms.
The offset terms are 12 ms and 4 ms. Their mean is 8 ms, so the estimator places the server clock 8 ms ahead of the client.
Under symmetric paths, each direction contributes 4 ms of network delay and the 8 ms offset interpretation is consistent. Without that symmetry assumption, the same exchange does not establish an exact one-way delay or exact offset.
The estimates are an 8 ms server-minus-client offset and an 8 ms round-trip path delay; the symmetry assumption remains part of the offset interpretation.
The living notebook
Explore the model
Interactive lab · sampling
More samples do not remove an unmodeled bias
For each independent comparison: Reset, set both p and n, predict, then inspect or Step. Compare p=0.2, n=20 with p=0.2, n=100. The exact binomial distribution concerns the mean of hypothetical independent late-observation indicators, not clock errors or newly sampled measurements.
- Mean sample proportion
- 0.5
- Sample-mean variance
- 0.0125
- Uniform CDF error bound
- ≤ 0.1062
Exact binomial masses for the mean of n independent Bernoulli trials, compared with normal mass between adjacent half-count boundaries; normal tails outside the finite support remain outside the bars. Playback highlights outcomes, not random samples. The Berry–Esseen bound applies to standardized CDFs, not individual bars or continuity-corrected errors. At p = 0 or 1, normal comparison and that bound are disabled. Normal-CDF evaluation uses a numerical approximation with absolute error below 7.5×10⁻⁸ (at most 1.5×10⁻⁷ per interval, before rounding). Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forMean variance p(1−p)/n decreases from 0.008 to 0.0016 here. That statistical reduction does not calibrate an asymmetric network path or establish a deterministic clock-error bound.
Pause & reason
Check your understanding
Your turn
Try it yourself
A clock begins within 1 ms of its reference and is bounded to 30 ppm rate error for 200 physical seconds. What absolute-error bound follows, and what would a clock step do to the argument?
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Convert ppm to a dimensionless rate and add worst-case accumulated error to the initial bound.
Compare with the solution
Thirty ppm times 200 seconds contributes 0.006 seconds. Adding 0.001 seconds gives 7 ms. An unmodeled step invalidates that no-jump bound; its magnitude must be included or a fresh bound established.
Keep the idea
Take it with you
- Offset, rate error, stability, and resolution describe different properties.
- Timestamp exchange estimates depend on path and clock assumptions.
- Local monotonic time measures suitable durations but does not provide a shared remote epoch.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.