The Imperfect Quartz
Every computer has a hardware clock — a Real-Time Clock (RTC) — typically driven by a vibrating quartz crystal. These are inexpensive and adequate for human-scale timekeeping, but they drift. A typical server clock drifts by 10–200 parts per million (ppm). At 200 ppm, a clock gains or loses about 17 seconds per day. After a week of no synchronization, two servers could be minutes apart.
NTP: Trying to Stay in Sync
To correct drift, servers use the Network Time Protocol (NTP). Periodically, a server contacts a time server over the network, measures the round-trip delay, estimates the one-way latency, and adjusts its local clock.
NTP is organized into Stratum levels — a hierarchy of accuracy:
| Stratum | Description |
|---|---|
| 0 | Primary reference sources: atomic clocks, GPS receivers, radio clocks. Not directly on the network. |
| 1 | Servers directly connected to Stratum 0 devices. The authoritative time servers. |
| 2 | Servers that synchronize from Stratum 1 servers. Most public NTP servers are here. |
| 3+ | Servers syncing from the level above. Accuracy degrades with each hop. |
Your laptop likely syncs from a Stratum 2 or 3 server. Cloud VMs typically sync from hypervisor-provided time sources.
The Fundamental Limitation
Even with NTP, your clock is never perfectly accurate. Because network latency is variable and asymmetric (the path from A to B may be faster than B to A), NTP can only estimate the true time. Over the public internet, NTP typically achieves accuracy within 1–50 milliseconds. On a well-managed LAN, it can reach sub-millisecond accuracy.
For a human reading a webpage, 50ms of clock error is invisible. For a database ordering millions of transactions per second, 50ms is an enormous window of ambiguity — thousands of events could fall inside it.
Interviewers frequently ask: "Can you use server timestamps to order distributed events?" The correct answer is: "Not reliably, because of clock skew and drift. NTP reduces the error but cannot eliminate it. For strict ordering, you need logical clocks or a system like Google TrueTime that explicitly models the uncertainty window."