Skip to content

True time lives in a window. ClockBound hands you both edges.

ClockBound is an open-source daemon and client library that gives every timestamp a reliable error bound โ€” an [earliest, latest] window around reference time โ€” so distributed systems can order events and reason about consistency with confidence.

74.5k

crates.io downloads

359

GitHub Stars

27

Contributors

27

Forks

The problem

A timestamp is a point estimate with no error bars 

Clocks drift. Reading one gives you a single number that looks authoritative but is quietly wrong by some unknown amount.

Picture two database nodes in different regions, each stamping a write with its local clock. If one clock is 5 ms fast and the other 5 ms slow, their timestamps can imply the wrong order, and no amount of comparing single numbers will reveal it.

ClockBound replaces the single number with a window that bounds reference time (UTC). When two windows don't overlap, the order is certain. When they do, your application knows it must not guess.

UTCclock_gettime()a single point โ€” may be wrongClockBoundearliestlatest
A naive timestamp is a single point that can silently drift from reference time (UTC). ClockBound returns a window that bounds it.

Quickstart

Running in a couple of commands 

Install the daemon, then read bounded time from your language of choice.

bash
# Install the RPM (RHEL / CentOS / Amazon Linux)
sudo rpm -i clockbound-*.rpm

# Enable and start the daemon
sudo systemctl enable clockbound
sudo systemctl start clockbound

Prefer step-by-step? Read the full Getting Started guide.

NTP (Time Sync)PHC deviceVMClockclockbounddaemonshared memory/var/run/clockboundas-of time + boundyour application (client)derives [earliest, latest]
Time sources feed the daemon; the daemon publishes time + error bound to shared memory; clients read it with no system call and derive the earliest/latest window.

How it works

A daemon that bounds time, clients that read it for free 

  • 1The daemon auto-detects NTP, PHC, and VMClock sources and keeps the system clock synchronized.
  • 2It continuously computes the clock error bound and writes time + bound into a shared-memory segment.
  • 3Clients read time, bound, and clock status from shared memory, then derive the earliest/latest window โ€” no system call.
  • 4A feed-forward sync algorithm decouples time calculation from the system clock for cleaner disruption handling.

Why ClockBound

Trustworthy time, without the footguns 

Bounded uncertainty

Every reading returns an [earliest, latest] interval that bounds UTC, plus a clock status โ€” not a single number you have to trust blindly.

Blazing-fast reads

Clients read time and its error bound straight from a shared-memory segment โ€” no system call, no daemon round-trip. Benchmarked at ~10.6M reads/sec.

Multiple time sources

Automatically discovers and blends NTP (Amazon Time Sync), a local PTP Hardware Clock (PHC), and the VMClock device for robust synchronization.

Disruption-aware

Reads the VMClock to detect clock disruptions during VM maintenance and reflects them in the clock status, so applications avoid acting on untrustworthy time.

Zero-config daemon

Batteries-included: the daemon auto-detects reference sources and platform, and runs on built-in defaults. An optional TOML config is there when you need it.

Clients in any language

First-party Rust crate and C/FFI library, plus a documented shared-memory protocol so you can write a client in any language that can mmap a file.

Use cases

Where bounded time changes the game 

Distributed databases

Order conflicting writes across regions and resolve "which happened first" without a central coordinator, using bounded timestamps instead of hopeful ones.

Financial markets & market data

Timestamp market data and orders with a bounded window, so exchanges and trading systems can reason about when information arrived at each node.

Audit & forensic logs

Attach an explicit time window to each log entry so investigators know the real uncertainty on every timestamp, not a false point value.

Consensus & coordination

Feed commit-wait style protocols a trustworthy upper bound on clock error to shrink waits while preserving correctness.

Event & transaction ordering

Decide consistent happened-before relationships between events produced on different nodes, independent of their geographic location.

The difference

clock_gettime() vs. ClockBound 

Same timestamp you already read โ€” now with the context you were missing.

Capabilityclock_gettime()ClockBound
Returns current time
Error bound on the reading
Synchronization status
Clock-disruption awareness
Cross-node event ordering

FAQ

Questions, answered 

Do I have to run this on AWS?

No. ClockBound works with any NTP source, a local PTP Hardware Clock, or the VMClock device. It is tuned for EC2 (where you get the most accurate bounds with the Amazon Time Sync Service), but it is not AWS-only.

What is the performance overhead of reading time?

Reads come from a shared-memory segment with no system call or daemon round-trip. The bundled C example measured roughly 10.6 million calls per second on a single thread.

What platforms and kernels are supported?

Linux on x86_64 and aarch64 (including AWS Graviton). VMClock-based disruption support needs a recent kernel โ€” Amazon Linux 2 kernel-5.10.223-211.872 and later, Amazon Linux 2023 kernel-6.1.102-108.177 and later, or upstream Linux 6.13+. See the Platforms page for details.

How is this different from just calling clock_gettime()?

clock_gettime() hands you a single timestamp with no indication of how wrong it might be. ClockBound returns the same kind of timestamp wrapped in an error bound plus a synchronization status, so your application can reason about uncertainty instead of ignoring it.

What does it cost? What is the license?

ClockBound is free and open source, dual-licensed under MIT and Apache-2.0. Use it under either license, at your option.

Stop trusting clocks blindly

Add reliable error bounds to your timestamps in minutes.