Why I Drift (I Cannot Help It)

Network time synchronization with NTP and PTPintermediate · standard · comprehensive | model: claude-opus-4-8 | 2026-07-05
Quick ref
chronyc tracking my current offset, drift, root dispersion
chronyc sources -v who I'm listening to and why
timedatectl sync state at a glance
ntpq -pn peer table for classic ntpd
ethtool -T eth0 does my NIC do HW timestamping?
pmc -u 'GET CURRENT_DATA_SET' PTP offset from master
adjtimex -p peek at kernel discipline state

Why I Drift (I Cannot Help It)

My heartbeat is a quartz crystal, and quartz ages, warms, and lies. Left alone I wander — synchronization is a control loop that corrects me continuously, not a lookup I perform once.

ppm
Parts per million; 1 ppm ≈ 0.0864 s/day. A cheap oscillator at 20 ppm drifts ~1.7 s/day.
offset
How far my time is from true time right now — the error to correct.
drift (frequency error)
The rate my offset grows; the disciplinary loop learns and cancels it.
jitter
Short-term noise in measurements, mostly from network and scheduling.

Wall clock (CLOCK_REALTIME)

Tracks UTC and can jump backward when I'm stepped. Use for timestamps, never for measuring elapsed time.

Monotonic (CLOCK_MONOTONIC)

Never steps backward, immune to my corrections. Use for durations, timeouts, and benchmarks.

Note Temperature dominates drift; a server that changes load changes its crystal frequency, so my drift is not a constant but a slowly moving target the loop must chase.

Time Scales I Answer To

ScaleDefinitionRelationship
TAIAtomic time, no leap seconds, monotonicThe physics baseline
UTCCivil time, kept near Earth rotation via leap secondsTAI − 37 s (as of 2024)
GPS timeAtomic, from the satellite constellationTAI − 19 s (no leaps)
Unix timeSeconds since 1970 epochCounts UTC, ignores leaps

Leap seconds

Inserted UTC steps (a 23:59:60) that make me repeat or skip a second — a discontinuity that breaks naive elapsed-time math.

Leap smearing

Google/AWS spread the leap second over ~24 h by slewing, so I never see 23:59:60. Never mix a smearing server with a stepping one.

Warning The IERS plans to abolish leap seconds by 2035, letting UTC−UT1 grow. Until then, assume any leap can arrive and test your daemon's smear policy.

The NTP Stratum Hierarchy

NTP is a tree of authority. Distance from a reference clock is stratum; error accumulates with every hop, so higher stratum means less trustworthy.

stratum 0
Reference clocks — GPS receivers, atomic clocks, radio (DCF77/WWVB). Not on the network directly.
stratum 1
Servers directly attached to a reference clock; the network's primary sources.
stratum 2–15
Each syncs from the layer above; 16 means unsynchronized.
pool 2.pool.ntp.org
DNS round-robin of volunteer servers; use the pool, not a single host.
ModeConfigUse
Client/serverserver host iburstNormal upstream sync
Symmetric peerpeer hostMutual sync between equals
Broadcast/multicastbroadcastclientLAN fan-out, lower accuracy

The Four-Timestamp Dance

Every exchange yields four timestamps: T1 (client send), T2 (server recv), T3 (server send), T4 (client recv). From these I compute offset and round-trip delay.

offset θ = ((T2 − T1) + (T3 − T4)) / 2
delay  δ =  (T4 − T1) − (T3 − T2)
Warning The offset formula assumes the network path is symmetric — equal latency each way. It never quite is, and the asymmetry you cannot measure becomes error you cannot remove. Accuracy is bounded by half the path asymmetry.
clock filter
Keeps the best of the last 8 samples (lowest delay), rejecting network jitter spikes.
selection
Intersection algorithm finds the majority whose intervals overlap — the truechimers.
falseticker
A source that disagrees with the majority and is discarded.
clustering
Winnows survivors to the most consistent set and picks a system peer.
root delay
Total round-trip delay back to the stratum-0 reference.
root dispersion
Accumulated maximum error bound; my honest statement of uncertainty.
Tip Configure at least 4 sources: one can't be checked, two can't break a tie, three lets you spot one liar, four survives a failure while still voting.

Kernel Discipline & Daemons

The daemon computes corrections; the kernel applies them via adjtimex(), either nudging my frequency (slew) or resetting me outright (step).

Slewing

Gradually speeds or slows me so time stays monotonic. Default for small offsets;