hometime servers±20 ppm ≈ 1.7 s/daystratum 1 · ref GPSstratum 2t1 10:00:00.000t4 10:00:00.031t2 10:00:00.095t3 10:00:00.096delay 30 msoffset +80 msslew +80 ms in 160 st1 = 0 nst2 = 800 nst3 = 1800 nst4 = 2000 ns← master port
Coloured: the parts the current step is about; the rest wait in whiteEnvelope (gold seal): an NTP request or reply, a PTP Sync or Delay_ReqSmall envelope (sky seal): the GPS pulse, a Follow_Up or a Delay_RespDotted lines: network links · solid: the GPS antenna cableA computer's quartz clock drifts, so it asks a time server. Time starts at a reference clock (GPS, stratum 0) and flows down the strata: stratum 1, stratum 2, then your laptop. One NTP exchange gives four timestamps; offset = ((t2 − t1) + (t3 − t4)) / 2 = +80 ms and delay = (t4 − t1) − (t3 − t2) = 30 ms. PTP uses the same idea with hardware timestamps and boundary clocks to reach below a microsecond. 198.51.100.1 and 203.0.113.123 are RFC 5737 documentation addresses; 192.168.1.0/24 is a private home range (RFC 1918). GPS time is 18 s ahead of UTC.

Why time matters

  1. Every computer keeps time with a quartz crystal, and crystals drift: 20 parts per million is almost 2 seconds a day. Logs from different machines only line up if clocks agree, certificates check dates, and banks must timestamp trades.

Strata

NTP's four timestamps

PTP: hardware time

On the wire, in numbers

;; step 1/11 · why-time · local
;; at your laptop
quartz tolerance  ±20 ppm
drift             20 × 10⁻⁶ × 86 400 s = 1.728 s per day
logs              events from two servers sort in the wrong order
certificates      TLS checks notBefore ≤ now ≤ notAfter (RFC 5280)
finance           EU high-frequency trading: within 100 µs of UTC
                  (Delegated Regulation 2017/574, MiFID II RTS 25)

NTP version 4 is RFC 5905: a 48-byte header over UDP port 123, offset θ = ((t2 − t1) + (t3 − t4)) / 2 and delay δ = (t4 − t1) − (t3 − t2). Real clients poll several servers repeatedly and filter the samples. Clock readings are illustrative (the laptop 80 ms slow, 15 ms each way); the arithmetic on them is exact. The 128 ms step threshold and 500 ppm slew limit are the reference implementation's defaults.