ash-time
Distributed time primitives for Rust. ash-time is a toolkit for reasoning about
order and causality across nodes — answering "did A happen before B?" without a
central coordinator.
Node A ── stamp(write) → ts=(103ms, 0) ──────────────────────────▶
│ message carries ts
▼
Node B ── recv(ts) → ts=(103ms, 1) ── stamp(read) → ts=(103ms, 2) ──▶
(103ms, 0) < (103ms, 2): the read is provably after the write.
Algorithms
Hybrid Logical Clock (ash_time::hlc)
Tracks causality while staying anchored to wall time. The clock ticks with the system clock when it can, and falls back to a logical counter to break ties within the same nanosecond.
use HlcClock;
let clock = new;
// stamp an outgoing message
let send_ts = clock.now.unwrap;
// advance on an incoming message — recv_ts is provably after send_ts
let recv_ts = clock.recv.unwrap;
assert!;
See the crate docs for the full API.
Installation
License
Licensed under the Apache License, Version 2.0.