Skip to main content

Crate ash_time

Crate ash_time 

Source
Expand description

§ash-time

Timestamps that tell you what happened before what — even across machines.

ash-time gives you a clock you can share across threads and nodes. It ticks with the wall clock when it can, and uses a logical counter to break ties when multiple events land in the same nanosecond. The result: every timestamp is strictly ordered and stays close to real time.

§Quick start

use ash_time::HlcClock;

let clock = HlcClock::new();

// Sender: stamp every outgoing message.
let send_ts = clock.now().unwrap();

// Receiver: advance local clock on every incoming message.
let recv_ts = clock.recv(send_ts).unwrap();

// Causality check: send happened before receive.
assert!(send_ts.happened_before(recv_ts));

Re-exports§

pub use hlc::HlcClock;
pub use hlc::HlcError;
pub use hlc::HlcTimestamp;

Modules§

hlc