ash_time/lib.rs
1//! # ash-time
2//!
3//! Timestamps that tell you what happened before what — even across machines.
4//!
5//! `ash-time` gives you a clock you can share across threads and nodes. It
6//! ticks with the wall clock when it can, and uses a logical counter to break
7//! ties when multiple events land in the same nanosecond. The result: every
8//! timestamp is strictly ordered and stays close to real time.
9//!
10//! ## Quick start
11//!
12//! ```
13//! use ash_time::HlcClock;
14//!
15//! let clock = HlcClock::new();
16//!
17//! // Sender: stamp every outgoing message.
18//! let send_ts = clock.now().unwrap();
19//!
20//! // Receiver: advance local clock on every incoming message.
21//! let recv_ts = clock.recv(send_ts).unwrap();
22//!
23//! // Causality check: send happened before receive.
24//! assert!(send_ts.happened_before(recv_ts));
25//! ```
26
27pub mod hlc;
28
29pub use hlc::{HlcClock, HlcError, HlcTimestamp};