Skip to content
hashkey.bond

Archivedistributed-systems

Clock Skew and TrueTime

Physical clocks are wrong by an unknown amount. Spanner turns that uncertainty into a wait.

Published
Reading time
1 min read

Distributed systems cannot order events by wall-clock timestamp alone: every machine's clock drifts, NTP corrects in steps, and VM suspend freezes time.

TrueTime

Spanner exposes time as an interval [earliest, latest] with a known uncertainty (typically a few milliseconds) backed by GPS and atomic clocks. Commit waits out the uncertainty:

commit_ts = TT.now().latest

After the wait, no transaction can have a timestamp earlier than commit_ts anywhere in the system. That yields external consistency — linearizability plus real-time order across data centers.

The cheap approximation

Without atomic clocks, bound skew with tight NTP and use hybrid logical clocks for ordering. You cannot get Spanner's guarantee, but you can get causality-preserving timestamps and detect unsafe assumptions.

Takeaway: treat time as an interval, not a point. If you need global real-time order, pay for bounded uncertainty or use a logical clock.