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
8//! retrieve the clock value on Linux systems, and transformations avoid
9//! operations that can be slow on non-Intel systems.
10//! * The number of system calls can be kept to a minimum. The "most recent
11//! timestamp" is
12//! always kept in memory. It can be read with just a load operation, and can be
13//! updated only as frequently as necessary.
14//!
15//! # Installation
16//!
17//! `coarsetime` is available on [crates.io](https://crates.io/crates/coarsetime) and works on
18//! Rust stable, beta, and nightly.
19//!
20//! Windows and Unix-like systems are supported.
21
22#![allow(clippy::trivially_copy_pass_by_ref)]
23#![cfg_attr(feature = "nightly", feature(test))]
24
25mod clock;
26mod duration;
27mod helpers;
28mod instant;
29#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
30mod updater;
31
32#[cfg(test)]
33mod tests;
34
35pub use self::clock::*;
36pub use self::duration::*;
37pub use self::instant::*;
38#[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
39pub use self::updater::*;