$ clocksource

v1.0.1

Library for times and durations with fixed-size representations

Downloads: 20.7M
Recent: 5.6M
Versions: 18
Updated: June 22, 2026

Latest Update Summary

Crate

Name: clocksource New version: 1.0.0 Release date: 2026-03-20T22:13:04.991276Z

Crate readme

Short description A Rust library for time and duration types with fixed-size representations.

Long description The clocksource library provides coarse (second-resolution) and precise (nanosecond-resolution) variants, plus atomic versions for concurrent use. All types use a single 32-bit or 64-bit integer internally, making them compact and efficient for arithmetic operations.

Features • coarse (second-resolution) and precise (nanosecond-resolution) variants • atomic versions for concurrent use • compact internal representation with 32-bit or 64-bit integers

Code Examples Add to Cargo.toml

 cargo add clocksource

Basic usage

 use clocksource::coarse;
use clocksource::precise;

let coarse_start = coarse::Instant::now();
let coarse_elapsed: coarse::Duration = coarse_start.elapsed();
println!("elapsed: {} seconds", coarse_elapsed.as_secs());

let precise_start = precise::Instant::now();
let precise_elapsed: precise::Duration = precise_start.elapsed();
println!("elapsed: {} ns", precise_elapsed.as_nanos());

let now = precise::UnixInstant::now();
let coarse_now = coarse::UnixInstant::now();

Linkshttps://docs.rs/clocksourcehttps://crates.io/crates/clocksourcehttps://github.com/iopsystems/clocksource

https://api.github.com/repos/iopsystems/clocksource/releases/299619301

Release info

Release version:

Release description

Code Examples

Patch update: 1.0.0 → 1.0.1

$ DOWNLOADS TREND

10.5M20.7M

$ VERSION HISTORY

v1.0.1June 22, 2026
v1.0.0March 20, 2026
v0.8.3March 20, 2026
v0.8.1January 23, 2024

$ LINKS

$ INSTALL

cargo add clocksource

Or add to Cargo.toml: clocksource = "1.0.1"