All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased - ReleaseDate
- Support for the
wasm32-wasip2target, alongside continued support forwasm32-wasip1. - Support for the monotonic clock on Emscripten targets, which use Emscripten's POSIX-compatible monotonic clock. (#120)
- Documentation on System Counter support for AArch64 platforms.
- Breaking change: mock support --
Mock,IntoNanoseconds, andClock::mock-- is now gated behind the newmockfeature flag. The feature is part of the default feature set, so builds using default features are unaffected, but builds usingdefault-features = falsemust now enablemockexplicitly. Additionally,with_clockbecomes a no-op when the feature is disabled. (#118) - Breaking change: the legacy
wasm32-wasitarget is no longer supported, as WASI support is now selected based ontarget_envbeing eitherp1orp2. Usewasm32-wasip1instead. - Switched from
winapitowindows-sysfor querying the monotonic clock on Windows. (#114) - Replaced
once_cellandcrossbeam-utilswithstd::sync::OnceLockandportable-atomic, dropping two dependencies in the process.portable-atomicis used with itsfallbackfeature so that platforms without native 64-bit atomic support continue to work. CLOCK_OVERRIDEthread local is now initialized with aconstblock. (#117)- MSRV bumped to 1.87, which is the minimum version required to support both WASI preview versions.
- Fixed compilation on 32-bit platforms, where
timespeccould no longer be constructed with struct literal syntax due to private fields. (#121)
0.12.6 - 2025-06-10
- Avoid potential divide by zero in calibration loop. (#113)
0.12.5 - 2025-01-01
- Fixed an issue with lossy truncation in checked arithemtic methods for
Instant. (#110)
0.12.4 - 2024-12-13
- Updated WASM support to work in WebWorkers. (#107)
0.12.3 - 2024-03-31
- Disabled counter support on iOS targets even if AArch64 is present. This is due to an issue where the necessary CPU instruction for reading the counter is not available on iOS.
0.12.2 - 2023-12-31
- Fixed an issue with the monotonic clock for macOS/iOS where it would undermeasure time compared to
what would be measured by
std::time::Instantdue to using a clock source that did not account for device sleep. (#97)
0.12.1 - 2023-10-31
- Populate global recent time before
Upkeepstarts. (#95)
0.12.0 - 2023-10-04
- Experimental support for ARM. (#91)
- Update
raw-cpuidto 11.0.
0.11.1 - 2023-05-28
- Added a new method,
Clock::delta_as_nanos, for getting the delta between two raw measurements as the whole number of nanoseconds instead of the initial conversion toDuration. (#86)
0.11.0 - 2023-03-24
Instant::elapsed()has been added. (#82)
Instant::duration_sinceandInstant::subnow saturates to zero. (#82)- Performance of
Instant::nowunder high contention has been improved. (#82)
0.10.1 - 2022-07-20
- Implement
std::error::Errorforquanta::Error. (#68)
- Fixed build issue on x86/x86_64 platforms that did not have SSE.
- Fix scaling factor for
window.performance.now()in WASM. (#72)
0.10.0 - 2022-05-18
- Documentation has been updated to reflect that
quantadoes not track time across system suspends. - Fixed a panic in the calibration loop if a certain edge case with TSC measurements is encountered.
- Updated a unit test that was frequently flaky to be more precise.
Instant::as_u64has been removed. As it provided direct access to an value that could fundamentally change from version-to-version, it felt like time to remove that footgun and push users more towards the API that mimicsstd::time.Clock::upkeephas been removed. It doesn't need to exist onClockdirectly, as we have had thequanta::set_recentfree function for a while now, and was just duplicating that.Clock::startandClock::endhave been removed. They saw limited usage and overall just added somewhat needless API clutter given that users who are looking to do ultra-precise timing will either want more control or use another technique such as instruction counting.
- CI tests for MIPS/ARM. (#55)
- Fixed compilation issue with
Mockon MIPS/ARM. (#55) - Simplified how TSC/RDTSC suppoort is detected, which should avoid some situations where it was assumed to be present, but actually was not. (#57)
- Pinned
crossbeam-utilstov0.8.5whereAtomicCell::fetch_updatewas introduced to fix, which fixes broken builds where Cargo chooses a version between0.8.0and0.8.5. - Update
raw-cpuidto10.2andaverageto0.13.
- Switched from
atomic-shimtocrossbeam-utilsfor better cross-platform atomic support. (#52)
- Support for WASM/WASI targets. (#45)
Instant::as_unix_durationas it was added in error.metricsfeature flag asmetrics-coreis no longer a relevant crate.
- Bumped dependency on
raw-cpuidto9.0in order to deal with a RustSec advisory.
- Incorrect method visibility for non-SSE2 implementation of
Counter. (#38)
- MSRV bumped to 1.45.0.
Clock::nowtakes&selfinstead of&mut self.- Fixed a bug where a failure to spawn the upkeep thread would not allow subsequent attempts to spawn the upkeep thread to proceed.
- New methods --
Instant::nowandInstant::recentfor getting the current and recent time, respectively. - New free function
quanta::with_clockfor setting an override on the current thread that affects calls made toInstant::nowandInstant::recent. - New free function
quanta::set_recentto allow customization of how global recent time is updated.
- Fixed a bug with not being able to start the upkeep thread at all. (#29)
- Add
Instant::as_unix_durationto get the duration of time since the Unix epoch from anInstant. - Remove
clocksourcefrom dependencies and tests as it no longer compiles on stable or nightly.
- Publicly expose
Clock::upkeepfor advanced use cases. - Relax constraints around checking for multiple sockets. (#25)
- Add support for MIPS/PowerPC. (#23)
- Publicly expose the
Errortype returned byUpkeep::start.
This version of quanta was a massive overhaul of man areas of the API and internals, which was
done in a single PR: (#19). You can read the PR
description for the finer details. All changes below are part of the aforementioned PR.
Clock::nownow returns a monotonic value in all cases.- No longer possible to get a negative value from
Clock::delta. - Calibration is no longer a fixed one second loop, and will complete when it detects it has a statistically viable calibration ratio, or when it exceeds 200ms of wall-clock time. In most cases, it should complete in under 10ms.
- Calibration is now shared amongst all
Clockinstances, running only once when the firstClockis created.
- Fix the logic to figure out when calibration is required. (#14)
- Small tweak to the docs.
- Switch to
machfor macOS/iOS as it was deprecated inlibc. (#12) - Switch to
core::archfor instrinics, and drop the feature flagged configuration to use it. (#12) - Switch to
criterionfor benchmarking. (#12)
- Differentiate between raw and scaled time by adding a new
Instanttype. (#10)
- Fixed support for Windows. It was in a bad way, but actually works correctly now!
- Switched to Azure Pipelines CI + Cirrus CI, including formatting, tests, and benchmarks, for Linux, macOS, Windows, and FreeBSD.
- Initial commit.