coarsetime/
lib.rs

1//! A crate to make time measurements that focuses on speed.
2//!
3//! This crate is a partial replacement for the `Time` and `Duration` structures
4//! from the standard library, with the following differences:
5//!
6//! * Speed is privileged over accuracy. In particular, `CLOCK_MONOTONIC_COARSE`
7//!   is used to retrieve the clock value on Linux systems, and transformations avoid
8//!   operations that can be slow on non-Intel systems.
9//! * The number of system calls can be kept to a minimum. The "most recent
10//!   timestamp" is always kept in memory.
11//!   It can be read with just a load operation, and can be
12//!   updated only as frequently as necessary.
13//!
14//! # Installation
15//!
16//! `coarsetime` is available on [crates.io](https://crates.io/crates/coarsetime) and works on
17//! Rust stable, beta, and nightly.
18//!
19//! Windows and Unix-like systems are supported.
20
21#![allow(clippy::trivially_copy_pass_by_ref)]
22
23mod clock;
24mod duration;
25mod helpers;
26mod instant;
27#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
28mod updater;
29
30#[cfg(test)]
31mod tests;
32
33pub use self::clock::*;
34pub use self::duration::*;
35pub use self::instant::*;
36#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
37pub use self::updater::*;