Hybrid Logical Clocks (HLC)

In 2026, Hybrid Logical Clocks (HLC) have become the standard for providing monotonic, causality-tracking timestamps in cloud-native distributed databases. HLC solves the primary drawback of physical clocks (drift and skew) and Lamport clocks (lack of correlation with real-world time) by combining both into a single 96-bit or 128-bit timestamp.

1. The Core Motivation

2. Timestamp Structure

A typical HLC timestamp (as implemented in CockroachDB) consists of:

  1. WallTime (64-bit): Physical time in nanoseconds since the Unix epoch.
  2. Logical (32-bit): A counter used to order events that occur within the same nanosecond or during physical clock stalls.

3. The Update Algorithm

Every node maintains its local HLC state.

Local Event

If node i performs a local action at system time S_i:

Message Receipt

When a node receives a message with timestamp T_{msg}:

4. Handling Clock Uncertainty

HLC does not eliminate clock skew; it requires an upper bound on how much nodes can drift (the Max Offset, typically 500ms).

5. Comparison: HLC vs. TrueTime

FeatureHybrid Logical Clock (HLC)Google TrueTime
HardwareCommodity (NTP-based)GPS + Atomic Clocks
UncertaintyLarge (~500ms)Tight (<7ms)
StrategyRead-Retry (Restart reads)Commit-Wait (Delay writes)
AvailabilityMulti-Cloud / PortableGoogle Cloud Only

See Also