Why a Single Global Clock Is a Comfortable Fiction
In a single machine, ordering events is trivial: there is one clock, one timeline, and every operation gets a timestamp that everyone agrees on. Distributed systems shatter that convenience. When Spanner runs across dozens of data centers on different continents, each machine has its own local oscillator, and even with constant correction, those oscillators drift apart by measurable amounts every second. Traditional distributed databases have handled this drift in one of two ways. The first is to avoid relying on real time altogether, using logical clocks such as Lamport timestamps or vector clocks that only capture the relative order of causally related events, never absolute wall-clock time. This works for correctness but throws away useful information: it cannot tell you that transaction A happened before transaction B if they never communicated, even when common sense says A really did finish first in real time. The second approach is to trust synchronized clocks blindly, using something like plain NTP time as if it were exact, which is fast but dangerous, because NTP synchronization error can genuinely reach tens of milliseconds under normal conditions and far more during network problems. Spanner's engineers recognized that both extremes throw away something valuable. Logical clocks discard real-world meaning; naive physical clocks discard honesty about their own error. TrueTime's insight was to keep the real-world meaning of a timestamp while being scrupulously honest about how much error surrounds it. Rather than reporting a clock reading as a fictitious point value, TrueTime reports it as what it actually is: a range within which the true time is guaranteed to fall. That reframing, treating uncertainty as data rather than as noise to be ignored, is the conceptual leap that makes everything else in this article possible. It also explains why TrueTime required custom hardware investment rather than being a pure software trick; measuring uncertainty tightly enough to be useful demands real physical time sources, not just clever algorithms layered on commodity clocks.
GPS, Atomic Clocks, and the Anatomy of an Interval
TrueTime.now() does not return a timestamp; it returns a structured interval with two bounds, commonly described as earliest and latest, guaranteed to bracket the actual current time at the moment the call was made. To make that guarantee meaningful, Google built dedicated time infrastructure into its data centers. Each data center hosts a set of time master servers, and each time master is equipped with either a GPS receiver, which derives extremely accurate time from satellite signals, or an atomic clock, typically a cesium or rubidium-based reference that keeps time with very low drift even without external signals. Using two independent technologies is deliberate: GPS receivers can fail due to antenna problems, jamming, or satellite outages, while atomic clocks can drift slowly over time without an external correction source. By cross-checking GPS-derived masters against atomic-clock-derived masters, and cross-checking masters against each other across different data centers, Spanner can detect a misbehaving reference and exclude it, rather than propagating a bad reading silently through the system. Every other machine in the fleet runs a lightweight timeslave daemon that polls a selection of these masters at short intervals, computing its own local offset and drift rate relative to them. Between polls, the daemon's uncertainty grows at a known, bounded rate, since local oscillators drift predictably within specified tolerances, and this growing uncertainty is exactly what feeds the width of the interval returned by TrueTime.now(). In practice, Google has reported that this interval width, denoted with the symbol epsilon, averages around a few milliseconds and rarely exceeds roughly seven milliseconds even under adverse conditions like network congestion or master downtime. The interval is not a passive report; it is an active, continuously recalculated bound that every part of Spanner's transaction logic treats as ground truth. Crucially, the system is designed so that even in worst-case scenarios, such as a burst of master failures, the bound remains a true guarantee rather than a best-effort estimate, because Spanner's design goal was correctness under the actual worst case, not merely good behavior in the common case.
Commit Wait: Turning Patience Into Proof
Having an honest uncertainty interval is only useful if the rest of the system actually uses it to make guarantees. This is where Spanner's commit wait protocol comes in, and it is arguably the single cleverest piece of engineering in the whole design. When a read-write transaction is ready to commit, Spanner assigns it a commit timestamp drawn from TrueTime, specifically chosen to be at or after the latest bound of the current TrueTime interval. Before making the transaction's effects visible to any other client, the coordinating server deliberately delays, waiting until it can be certain, based on TrueTime's guarantees, that real time has actually advanced past that assigned commit timestamp. Concretely, the server waits until TrueTime.now() reports an earliest bound that has passed the transaction's commit timestamp. This delay is usually small, on the order of a few milliseconds, matching the typical width of the uncertainty interval, but it is a real, measured pause, not a theoretical nicety. The payoff for this patience is enormous: it guarantees that if transaction T1 externally completes, meaning some client has observed its result, before transaction T2 externally starts, then T1's commit timestamp is guaranteed to be less than T2's commit timestamp, even if T1 and T2 executed on servers on opposite sides of the planet with no direct communication between them. This property is called external consistency, sometimes called strict serializability, and it is a strictly stronger guarantee than the more commonly discussed serializability, because it ties the logical transaction order to the actual real-world, wall-clock order that external observers experience. Without commit wait, two transactions could be assigned timestamps that look correctly ordered on paper, yet because of clock uncertainty, the causally later transaction might actually have committed first in real time, silently breaking the illusion of a single global timeline. Commit wait closes exactly that gap by refusing to reveal results until the uncertainty window has provably closed, converting a probabilistic clock reading into a deterministic ordering guarantee.
What TrueTime Costs, and Why Spanner Pays It Anyway
No engineering decision is free, and TrueTime's guarantees come at a real, quantifiable cost. Every read-write transaction that commits pays the commit-wait delay, typically a handful of milliseconds, as pure added latency before its effects become externally visible. For workloads issuing many small transactions, this overhead can matter, and Spanner's designers were candid in their published research that keeping epsilon small was an ongoing engineering priority precisely because commit wait scales directly with it: a sloppier clock infrastructure with wider uncertainty bounds would mean slower commits across the entire fleet. This is why Google invested in dedicated GPS and atomic clock hardware rather than relying on commodity NTP synchronization over the public internet, since the entire cost-benefit calculation of the system hinges on keeping that interval narrow. It is also worth noting what TrueTime does not do: it does not eliminate coordination for distributed transactions that touch multiple machines, which still require a variant of two-phase commit layered on top of Paxos-replicated groups for fault tolerance. TrueTime specifically solves the timestamp-ordering problem, not the broader problem of atomically committing changes across shards. Despite the added latency, Spanner's designers judged the trade worthwhile because the alternative approaches were worse for their use case: purely logical clocks cannot give external consistency with real-time meaning, and centralized timestamp servers, where a single sequencer hands out all timestamps, become both a bottleneck and a single point of failure at global scale. TrueTime lets every server independently compute correct, globally meaningful timestamps without ever talking to a central authority for each transaction, trading a small, bounded, and predictable latency cost for the elimination of a much larger architectural liability. The lesson generalizes well beyond Spanner: in distributed systems, explicitly modeling and bounding your uncertainty, rather than assuming it away, often yields both stronger correctness guarantees and better performance than either extreme of ignoring the problem or over-engineering a workaround for it.
Beyond Spanner: Why This Idea Reshaped Distributed Databases
TrueTime's influence extends well past Google's internal infrastructure. When Google published the Spanner paper describing TrueTime publicly, it demonstrated to the wider database and distributed systems community that strong, real-time consistency guarantees were achievable at planetary scale, provided you were willing to invest in the physical infrastructure to make clock uncertainty small and provable. This inspired an entire generation of systems, including CockroachDB, YugabyteDB, and TiDB, to adopt similar hybrid logical clock or bounded-uncertainty approaches, though most of these systems, lacking Google's custom atomic clock and GPS hardware deployed in every data center, had to use somewhat wider uncertainty bounds or fall back to hybrid logical clocks that combine physical time with logical counters. The core conceptual contribution, however, transcends any specific implementation: uncertainty, once measured and bounded rather than assumed away, can be a resource rather than merely a liability. This idea echoes far beyond databases. In network protocol design, in sensor fusion for robotics, and in distributed consensus more broadly, systems that explicitly track and communicate their own error bounds tend to be more robust than systems that implicitly assume perfection and fail unpredictably when that assumption breaks. Spanner's TrueTime is, in a sense, a case study in intellectual honesty as an engineering principle: rather than hiding the messy reality of imperfect hardware clocks behind an abstraction that pretends otherwise, Google's engineers exposed that messiness directly to the application layer, in a carefully quantified and actionable form, and built a rigorous protocol, commit wait, on top of that honesty. The result was a database that offers guarantees previously thought to require either sacrificing global scale or sacrificing strong consistency, achieved instead by respecting the true, uncertain nature of physical clocks rather than wishing it away. It remains one of the clearest illustrations in modern computer science of how acknowledging a hard physical limitation precisely, rather than approximating around it, can unlock capabilities that a naive workaround never could.
Frequently asked questions
What exactly does TrueTime.now() return?
It returns a time interval, typically expressed as an earliest and a latest bound, rather than a single timestamp. Spanner guarantees that the true, actual current time at the moment of the call falls somewhere within that interval. The width of the interval, often just a few milliseconds, reflects the current measured uncertainty of the local clock relative to the reference time infrastructure.
Why does Spanner use both GPS receivers and atomic clocks instead of just one?
The two technologies fail in different, largely uncorrelated ways. GPS receivers can lose signal due to antenna issues, interference, or satellite problems, while atomic clocks can drift slowly if left uncorrected for long periods. By cross-checking GPS-derived time masters against atomic-clock-derived time masters, and comparing masters across data centers, Spanner can detect and exclude a misbehaving reference rather than trusting a single fragile source.
What is commit wait, and why does Spanner deliberately slow itself down?
Commit wait is a deliberate pause, usually a few milliseconds, that Spanner inserts before making a committed transaction's effects visible to other clients. The server waits until TrueTime confirms that real time has genuinely advanced past the transaction's assigned commit timestamp. This small, measured delay is what guarantees correct real-time ordering between transactions across the entire globally distributed system.
What is external consistency, and how is it different from ordinary serializability?
Ordinary serializability guarantees that transactions behave as if executed in some sequential order, but that order does not have to match real-world, wall-clock time. External consistency, which Spanner provides through TrueTime and commit wait, adds the stronger guarantee that if one transaction finishes before another one starts in real time, as observed by any external client, the earlier transaction is also ordered first in Spanner's internal timeline.
Could Spanner work without TrueTime, using only logical clocks?
It could achieve internal consistency using purely logical clocks such as Lamport timestamps, but it would lose the ability to guarantee real-time external consistency across independent, non-communicating transactions. Logical clocks capture causal order between events that interact, but they cannot, by themselves, correctly order two transactions that never communicated yet occurred at genuinely different real-world times, which is precisely the gap TrueTime and commit wait are designed to close.
Try it live
Everything above runs in your browser — open Google Spanner's TrueTime API: Turning Clock Uncertainty into a Global Guarantee and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Google Spanner's TrueTime API: Turning Clock Uncertainty into a Global Guarantee simulation