#clock #time


clocksource provides TSC access with transparent fallback to clock_gettime()

9 releases

Uses old Rust 2015

0.5.0 Jun 27, 2019
0.4.0 Mar 18, 2018
0.3.0 Mar 18, 2018
0.2.3 Nov 18, 2017
0.2.0 Aug 27, 2016

#99 in Operating systems

Download history 124/week @ 2021-04-11 107/week @ 2021-04-18 87/week @ 2021-04-25 103/week @ 2021-05-02 76/week @ 2021-05-09 92/week @ 2021-05-16 41/week @ 2021-05-23 90/week @ 2021-05-30 115/week @ 2021-06-06 88/week @ 2021-06-13 164/week @ 2021-06-20 91/week @ 2021-06-27 148/week @ 2021-07-04 150/week @ 2021-07-11 127/week @ 2021-07-18 69/week @ 2021-07-25

420 downloads per month
Used in 3 crates (via tic)


265 lines

clocksource - high performance clocks for Rust

Clocksource allows access to alternate clocksources like the TSC on your Intel x86 CPU. Most modern processors support 'constant_tsc' allowing us to use this counter as a high resolution clock. The cost of reading this counter can be much lower than calls to 'clock_gettime()' - especially on virtualized environments.

Unfortunately, this requires we use nightly rust until the asm!() macro is stabilized. We provide fallback for users on stable rust, this should allow zero-cost abstraction of clock_gettime() for stable builds without benefit of the high-performance timing.

conduct-badge travis-badge downloads-badge release-badge license-badge

Code of Conduct

NOTE: All conversations and contributions to this project shall adhere to the Code of Conduct

Getting clocksource

add clocksource to your dependencies and start using it

The API documentation of this library can be found at docs.rs/clocksource.


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.