fast_clock/
lib.rs

1#![no_std]
2
3#[cfg(feature = "std")]
4extern crate std;
5
6mod clock_synchronization;
7pub use clock_synchronization::ClockSynchronization;
8
9#[cfg(all(feature = "tsc", target_arch = "x86_64"))]
10pub mod tsc;
11
12#[cfg(feature = "std")]
13pub mod std_clocks;
14
15pub trait Clock: Copy {
16    type Instant: Copy + Ord;
17    fn now(self) -> Self::Instant;
18}
19
20pub trait CalibratedClock: Clock {
21    fn between_u64_ns(self, later: Self::Instant, earlier: Self::Instant) -> u64;
22    fn add_u64_ns(self, base: Self::Instant, offset: u64) -> Self::Instant;
23    fn sub_u64_ns(self, base: Self::Instant, offset: u64) -> Self::Instant;
24}