
two computers can't agree on what time it is
January 1975. Paul Johnson and Bob Thomas send a short note out over the ARPANET, RFC 677, "The Maintenance of Duplicate Databases." The same database lives on several machines, each one takes edits, and the copies have to end up identical. Their fix is to stamp every change with the clock time and the machine's ID, and let the latest stamp win everywhere.
Leslie Lamport reads it. He has just spent years on a monograph about special relativity, so he knows what a clock on the wall is worth. In Einstein's picture, two observers far apart can't agree on which of two events happened first unless one of them could have caused the other. Lamport sees that Johnson and Thomas have built an algorithm about causality without knowing it, and that it can get causality wrong. A reply can carry an earlier timestamp than the message it answers, because the replying machine's clock runs a little slow.
So he throws the wall clock out. What's left is contact. If I send you a message and you receive it, my sending came before your receiving. If your receiving came before something else you did, that's before too. The chain of touches is the only order anyone can prove.
The mechanism fits on an index card. Every machine keeps a counter. Every message carries the sender's counter. When a message arrives, the receiver sets its own counter to one past the larger of the two.
i set my clocks to you
That is the receive rule, word for word. You don't keep your own time when someone reaches you. You take theirs and step past it.
Two events that never touched, directly or through anyone else, are concurrent. The paper doesn't claim they happened at the same instant. It says the question of which came first has no answer, and that any system pretending to answer it is making something up.
"Time, Clocks, and the Ordering of Events in a Distributed System" ran in Communications of the ACM in July 1978, pages 558 to 565. Jim Gray told Lamport he'd heard two opinions of it, that it was trivial and that it was brilliant; Lamport said he couldn't argue with the first and wasn't inclined to argue with the second. It became his most cited paper. It took the PODC Influential Paper Award in 2000, since renamed the Dijkstra Prize, and the SIGOPS Hall of Fame Award in 2007. People who swear they've read it tend to forget the second half, where he shows that a totally ordered log lets you build any distributed system as a replicated state machine. Lamport says he once had to reread it to confirm he'd written that part.
Now the texts.
Saturday, 11:41 pm. You type "you up?" and send it. At 11:41 pm they type "you up?" and send it. Both phones say Delivered. Neither of you had seen the other's message when you sent yours. There was no touch. The two sends are concurrent, and the paper is firm about what that means. Nobody texted first.
On Sunday you'll each tell a friend you texted first, and both of you will be telling the truth, because the one thing that could settle it, a shared clock, doesn't exist. Your phone is set by one tower and theirs by another. iMessage shows you your send time. It shows them theirs.
Read receipts were supposed to end this. They don't. A read receipt is a receive event. It proves contact. It can tell you your message came before their reading of it. It can't tell you whether their reply came before or after they saw your second text, the one you sent to soften the first.
Some people have been running Lamport clocks in their DMs for years without the vocabulary. The move where you text someone and then send a Snapchat right after, so that when they open the snap you know they've seen the text: that's an acknowledgement message. It forces a touch. The open proves the read.
Lamport wrote the other half of this in an email on 28 May 1987, when a colleague asked what a distributed system even was. His definition was a system in which the failure of a computer you didn't know existed can make your own computer unusable. Read that with a phone in your hand. The friend who screenshotted your message to someone else. The group chat you were never in, where your reply was discussed before you sent it. Your conversation has more nodes than two, and some of them you'll never see.
Fights about who texted first and who waited longer are fights about the wall clock, and the wall clock was never admissible. What's admissible is the chain. This answered that. That came after this. If you want to know how a relationship actually went, you don't sort the messages by timestamp. You follow what replied to what.
git keeps history this way. A commit knows its parents and nothing else. Draw the log of a relationship as a graph and the two Saturday texts sit on separate branches, side by side, at the same height, and then merge.
You didn't text first. You texted concurrently.
The painting: Hans Holbein the Younger, The Ambassadors (1533), National Gallery, London. Public domain. The sundials on the shelf disagree with each other.
Sources