Clock synchronization is the problem of keeping the physical clocks of many networked computers reading close to one another, and ideally close to a standard reference time. Each machine has its own quartz oscillator, and these oscillators run at slightly different rates, so two clocks that start in agreement will slowly diverge. This drift, combined with the fact that messages take a variable and unknown amount of time to cross a network, makes it surprisingly hard to agree on what time it is.
The Network Time Protocol, specified in RFC 5905, is the long-standing answer to this problem on the Internet. It estimates the offset between a local clock and a more accurate server clock by exchanging timestamped messages and accounting for the round-trip delay, then steers the local clock toward the reference. David Mills’s NTP project pages describe how the protocol arranges servers in a hierarchy and achieves accuracies generally in the range of a tenth of a millisecond on fast local networks and up to tens of milliseconds across the wider Internet.
The difficulty is fundamental: because network delays are variable, a receiver can never know exactly how long a timestamp took to arrive, so it can only estimate the true offset. RFC 5905 documents the filtering and selection algorithms NTP uses to reject bad samples and converge on a good estimate despite this uncertainty.
Because perfect physical synchronization is impossible, many distributed systems avoid depending on it. Instead of asking “what time is it” they ask “which event came first,” and they answer that with logical time rather than wall-clock time. This is why clock synchronization sits alongside, rather than replaces, the logical-clock techniques used to order events in distributed systems.