concept Backend & software
Logical clocks versus wall-clock timestamps
A send at logical time 3 and a receive at 6 respect message order, even if their wall clocks read 90 ms and 80 ms. Remove the message link and the same counts can label concurrent events.
What it means
If one event happens before another, its Lamport timestamp is smaller. The reverse is not guaranteed: seeing logical timestamps 3 and 6 does not tell you whether the events were connected. A Lamport timestamp is a counter value, not a time of day.
Here, happens before means there is a sequence you can follow from one event to the other: forward through events on the same process, from a message send to its matching receive, or along a chain of those links. Events are concurrent if neither happens before the other in this sense. They need not occur at the same instant.
Try it
Simulation: Start with Message relation set to receive. Process A's counter starts at 2, so A labels its send 3 and includes 3 in the message. Process B's counter is already 5. To label the receive, B takes the larger of its own count and the message count, then adds one: max(5, 3) + 1 = 6.
Logical clocks versus wall-clock timestamps
Explain causality through happens-before rather than synchronized clock values
Receive clock exceeds send clock under Lamport update.
Process A
- Before event2
- Send event3
- Wall clock reading90 ms
Message A → B
- Causal relationA happens before B
Process B
- Before event5
- Receive event6
- Wall clock reading80 ms
Wall order
- B relative to AEarlier reading
Lanes show the stipulated process events, not elapsed time. The message creates a causal relation only in the receive case; counter inequality alone cannot establish one.
Evaluated inputs
- Required scenario evidence
- provided
- Sender logical clock before send
- 2 count
- Message relation
- receive
- Receiver clock before receive
- 5 count
- Receiver wall reading
- 80 ms
- Sender wall reading
- 90 ms
Two events and one optional message edge, no vector clocks, clock synchronization or real trace.
About this model
The controls set only a local, bounded scenario. The computed branch is not a verdict about a live system. Inputs listed as not evaluated did not participate in this branch after validation.
Reset restores the original inputs. It does not change the open or closed state of help or FAQ answers.
Now change only Message relation to independent. Look at both the message arrow and the counts. With no arrow, B's event is a local event, not a receipt of A's message. B simply advances from 5 to 6. The labels are still 3 and 6, but the result changes from causally ordered to concurrent: in this two-event graph, there is no other path connecting them. Reset restores the original message relation, counts, wall readings, and evidence setting.
What the wall readings tell you
In both cases, A's wall clock reads 90 ms and B's reads 80 ms. Sorting by those readings puts B first. In the message case, that would put the receipt before the send. The clocks do not have to agree for you to know which happened first: B received the very message A sent. In the independent case, those same readings supply no such link.
Clock choice and evidence of a link are separate issues. For example, on Linux, CLOCK_REALTIME can jump when wall time is changed. CLOCK_MONOTONIC avoids those wall-time steps, but its readings do not identify which send a different process received. Neither a difference in wall readings nor a difference in logical counts gives you the message's travel time in this example.
Set B’s wall reading to 90 ms, equal to A’s. In the message case the logical send and receive still have counts 3 and 6. Matching wall readings did not erase the causal link; removing the message still changes that link without changing the counters in this particular example. The local clock description here refers to Linux man-pages 6.19, not a claim about a particular installed kernel.
In practice
When comparing two log entries, mark what you know about each process's local event sequence and look for a send matched to a receive. If you can follow a path from one entry to the other, their Lamport counts should increase in that direction. Use the counts to check the path, not to invent one.
Distinguish a known absence from a gap in your records. The independent example explicitly rules out a connecting path. If you do not know the message relation, the appropriate comparison is Required scenario evidence set to missing: the order is unknown, not necessarily concurrent. The simulation neither inspects a real trace nor synchronizes clocks. If all you have are the numbers 3 and 6, the useful next observation is a link between the events, not a more precise timestamp.
Frequently asked questions
Editorial questions based on the listed sources and explicitly labeled local examples.
Can wall clocks disagree?
Yes. Wall-clock timestamps from different machines can disagree. A logical clock captures modeled causal constraints without requiring those clocks to agree.
Can concurrent events have different logical times?
Yes. Different logical timestamps alone do not prove one event caused the other. The happens-before implication works in one direction.
Why take max on receive?
The receiver must advance beyond both its own timestamp and the timestamp carried by the message. Taking their maximum and adding one accomplishes this in the illustrated Lamport clock.
Do Lamport clocks measure milliseconds?
No. A logical counter orders modeled causal events. Its difference is not a duration; in particular, the gap between a send at 3 and a receive at 6 is not a network latency measurement. The wall-clock readings are separate observations.
Sources & model boundaries
Primary references used for this explanation. The interactive example is an educational model, not a live check.
- Time, Clocks, and the Ordering of Events in a Distributed System
logical clocks. Causal order implies increasing logical timestamp; converse not required; receive advances past message timestamp.
Checked .
- clock_gettime(2)
Linux man-pages 6.19, DESCRIPTION: CLOCK_REALTIME and CLOCK_MONOTONIC. Linux monotonic time avoids discontinuous wall-time changes, but may be frequency-adjusted and excludes suspend. It supplies no causal link between processes.
Checked .