October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

Why Distributed Systems Can’t Trust Timestamps—and How Logical Clocks Help

Wall-clock timestamps can reverse cause and effect across machines. Lamport clocks preserve causal precedence, but they do not provide UTC time or elapsed duration.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A timestamp is a machine’s estimate of physical time, not proof that one event caused another. Clocks on different computers can disagree, so sorting their timestamps can put an effect before its cause. Lamport logical clocks address that specific problem: they preserve causal order, but they do not tell you the UTC time or how much time elapsed.

Why can timestamps be wrong in a distributed system?

Each computer keeps a local estimate of physical time. The estimates can differ because of clock skew, drift, delays in synchronization, or clock adjustments. A timestamp from one machine therefore cannot automatically be compared with a timestamp from another as if both came from a perfectly shared clock.

As an Amazon Associate I earn from qualifying purchases.

Imagine process A records an event at 10:00:00.100, sends a message, and process B records the resulting event at 10:00:00.090. If B’s clock lags enough, a wall-clock sort places the consequence first. These times are illustrative, not a measured incident. Google’s Spanner documentation describes the underlying risk: a later transaction handled by a server with a lagging local clock could receive an earlier timestamp, potentially causing a snapshot to omit an earlier completed transaction. Google Cloud’s Spanner documentation

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Wall-clock time remains useful for log displays, deadlines, and human-facing event records. The important distinction is between “the clock says this was earlier” and “this event causally preceded that one.”

What does causal order mean?

In a distributed system, an event happened before another when it could have influenced it: they occurred in that order within one process, or the first event sent a message that the second received. This relation is a partial order. Events connected by such a path are ordered; independent events on separate processes may be concurrent and have no causal order.

A sorting rule can still place every event in a sequence, but that does not mean it has discovered the true order of concurrent events. It may simply be applying a convention.

How do Lamport logical clocks work?

A Lamport clock assigns each process an integer counter. The counter advances as events occur and is adjusted when messages carry information about earlier events. Leslie Lamport’s 1978 paper establishes the key condition: if event A happened before event B, then A’s logical timestamp is less than B’s. Lamport’s paper, “Time, Clocks, and the Ordering of Events in a Distributed System”

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. For a local event: increment the process’s counter before assigning the event its timestamp.
  2. When sending a message: attach the current counter value to the message.
  3. When receiving a message stamped t: set the local counter to max(local_counter, t), then increment it. Assign the resulting value to the receive event.

This rule ensures that a message’s receive event is timestamped later than its send event, and that local event order is preserved. It does not reconstruct every causal relationship: two concurrent events can receive different counter values, and a smaller Lamport timestamp does not prove that the lower-valued event caused the higher-valued one.

How can a system order concurrent events?

If an algorithm needs a total order—one in which every pair of events can be sorted—it can compare a pair consisting of the Lamport timestamp and a stable process identifier. Compare the timestamp first, then the identifier when timestamps match. This gives a deterministic tie-break and extends the causal order, but it does not make concurrent events causally related or reveal which physically occurred first. Lamport discusses this extension in the 1978 paper linked above.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Physical clocks, Lamport clocks, and TrueTime

Mechanism What it represents Ordering guarantee Concurrent events Elapsed time
Wall clock An estimate of physical time Timestamp order reflects clock readings; disagreement can reverse causal order May sort them, but the reading alone does not establish causality Can support duration estimates subject to clock accuracy and adjustment
Lamport clock Logical event order If A happened before B, then L(A) < L(B) Can be ordered by timestamp plus process-ID tie-break, by convention No
Spanner TrueTime An interval representing possible physical times Spanner documents a guarantee that a timestamp whose generation finishes before another begins is smaller than the latter timestamp Spanner uses its timestamp guarantees for transactions and external consistency Represents bounded uncertainty in physical time; it is not a Lamport counter

Google Cloud describes TrueTime as a distributed clock with an uncertainty interval, used by Spanner to support transaction timestamp guarantees and external consistency. That is a system-specific approach to physical-time uncertainty, not a property of logical clocks generally. Google Cloud: Spanner, TrueTime, and external consistency

Which kind of time should an application use?

  • Use wall-clock timestamps when people need to see approximate event times or a system needs deadlines. Treat cross-machine ordering as uncertain unless the application’s clock assumptions justify it.
  • Use Lamport clocks when the requirement is to preserve causal precedence or provide a deterministic order for a distributed algorithm. Do not use them to report UTC or measure durations.
  • Use a system with explicit physical-time uncertainty guarantees when transaction semantics require stronger real-time ordering. Spanner’s TrueTime is one documented example; its guarantees depend on that system’s design and assumptions.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.