advanced24 min studyLesson 231 in Engineering

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

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.

∣C(t)−t∣≤ϵ0+ρ(t−t0)|C(t)-t|\leq\epsilon_0+\rho(t-t_0)
For t≥t_0, initial absolute error is bounded by epsilon_0 seconds and rate error by dimensionless rho seconds per second, with no intervening clock jumps. This is a conditional worst-case bound, not a typical-error estimate.↔ Scroll wide equations horizontally.

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.

θ^=(t2−t1)+(t3−t4)2,δ=(t4−t1)−(t3−t2)\widehat\theta=\frac{(t_2-t_1)+(t_3-t_4)}{2},\qquad\delta=(t_4-t_1)-(t_3-t_2)
All timestamps use seconds with compatible epochs. Theta estimates server-minus-client offset and delta estimates round-trip path delay, assuming negligible rate change during the exchange; interpreting theta as the true offset additionally requires symmetric one-way delay.↔ Scroll wide equations horizontally.

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.

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.

  1. 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.

  2. 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.

  3. 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 result

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.

Explore the model

Interactive lab

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.

More samples do not remove an unmodeled biasExact 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). Current readings: Mean sample proportion: 0.5; Sample-mean variance: 0.0125; Uniform CDF error bound: ≤ 0.1062. All parameters are adjustable with the labeled controls below.Exact distribution of the mean of 20 independent Bernoulli variables with success probability 0.5; playback highlights outcome 0.00.250.50.75100.0580.1150.1730.23Sample mean · k / nProbability massNormal bin masses are an approximationk = 0 · exact probability = 9.54e-7
Exact binomial massNormal interval massHighlighted outcome / mean
Mean sample proportion
0.5
Sample-mean variance
0.0125
Uniform CDF error bound
≤ 0.1062
t = 0 s

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.

Check your understanding

A clock has an initial error bound of 2 ms and an uninterrupted rate-error bound of 20 ppm. What can be justified after 100 physical seconds without another correction?

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.

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.