Clock Synchronization Demo

Visualize clock offset, drift, network delay, NTP/PTP exchange timing, and correction quality

animation
clock-sync
networking
timing
ntp
ptp
iot
intermediate
Foundation networking Distributed time Interactive animation

Clock Synchronization Workbench

See why IoT devices need shared time, how drift accumulates between sync events, and why network delay, jitter, and asymmetric paths limit NTP, PTP, SNTP, and gateway beacons.

16.2 ms Offset before sync
5.6 ms Expected residual after sync
Within target Planning result
40.0 ms RTT Measured round trip

What

Clock sync estimates how far a device clock is from a reference clock, then corrects it or slows/speeds it back into line.

Why

Bad time breaks event ordering, TDMA slots, security token checks, log correlation, and coordinated actuation.

Try First

Use NTP campus, press Step Exchange, then increase asymmetry. The offset estimate becomes biased by half the path imbalance.

Notice

Frequent sync reduces drift, but it cannot remove delay asymmetry. PTP improves precision by timestamping close to the wire.

Scenario

Controls

0 ppm20 ppm100 ppm
1 s512 s3600 s
1 ms20 ms300 ms
0 ms5 ms100 ms
-80 ms4 ms80 ms

Drift in ppm means microseconds gained or lost per second. A 20 ppm oscillator can drift about 20 ms over 1000 seconds.

Message timing and clock error

A device compares its local clock with a reference by exchanging timestamped messages.

1. Drift builds

Exchange timeline

Offset between syncs

NTP correction-16.2 ms
Delay estimate40.0 ms RTT
Asymmetry bias2.0 ms
Next-sync drift10.2 ms
NTP four-timestamp exchange Protocol model currently shown in the timeline.
5.6 ms uncertainty Residual caused by asymmetry, jitter, and timestamping limits.
Target is feasible Planning result including residual plus drift until the next sync.

Current explanation

Clock drift builds until the next synchronization event. The device clock gains or loses time according to its oscillator drift. Resync interval controls how much error can accumulate before the next correction.

1. Drift builds

Oscillator drift accumulates offset between synchronization events.

2. Timestamp exchange

Client and reference exchange timestamps over a delayed network path.

3. Estimate offset

NTP/PTP estimate offset and delay, but asymmetry creates bias.

4. Correct clock

Step or slew the clock, then choose the next resync interval.
Learning Support

Minimum Background

Offset is the current time difference. Drift is the rate that this difference grows. Jitter is short-term variation.

Mental Model

A sync protocol asks: how late did the message arrive, and how far should I move my local clock?

Key Limitation

Round-trip protocols can estimate delay, but unequal forward and return paths bias the offset estimate.

Quick Reference

NTP Offset

theta = ((T2 - T1) + (T3 - T4)) / 2. This estimates the correction from client time to server time.

NTP Delay

delta = (T4 - T1) - (T3 - T2). It estimates round-trip delay, not one-way delay.

Drift

drift_ms = ppm * interval_s / 1000 for one clock relative to a reference.

Asymmetry

If forward and return paths differ by 10 ms, round-trip offset can be biased by about 5 ms.

PTP

PTP can reach sub-microsecond accuracy when switches and endpoints support hardware timestamping.

Step vs Slew

Stepping jumps the clock. Slewing adjusts the rate so applications see monotonic time.

Guided Practice

NTP Campus

Use NTP with a 50 ms target. Increase interval and watch drift consume the budget.

PTP Control

Select PTP. Hardware timestamping and short intervals make the target much tighter.

Sleepy Device

Select SNTP. Long sleep intervals save power but allow much larger drift before resync.

Asymmetry Test

Move path asymmetry away from zero. Residual error rises even when delay estimate still looks stable.

Correction Choice

Use Step for immediate correction; use Slew when monotonic application time matters.

Design Decision

For each deployment, choose a protocol, target accuracy, resync interval, and redundancy plan.