v1.0.0 — Stable API #1
jamesgober
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
v1.0.0 — Stable API
clock-libreaches 1.0. The public surface, the performance, the documentation, and the supply-chain story are all settled. From this release forward, every change against this major version is non-breaking.What
clock-libIsA thin, well-inlined layer over
std::timethat gives you the two kinds of time every program needs — monotonic for measuring elapsed time, wall-clock for timestamps — as distinct types the compiler refuses to mix. AClocktrait makes time-driven code testable withoutthread::sleep. Zero runtime dependencies, nounsafe,no_std-compatible.The Stable Surface
Everything below is committed for the 1.x line and will not change without a major version bump.
Tier-1 free functions
now,elapsed,wall,unix,unix_ms,unix_ns— one-line entry points for the common case.Types
Monotonic—now,elapsed,duration_since,checked_duration_since,saturating_duration_since.Wall—now,unix_seconds,unix_millis,unix_nanos. Pre-epoch system clocks saturate to0; no panics, no silent wrapping.Trait + implementations
Clock—Send + Synctrait withnowandwallmethods. Blanket impls forArc<C>and&C.SystemClock— zero-sized,Copy,const-constructible production clock.ManualClock— lock-free, atomic-offset test clock.new,advance,offset.Constants
VERSION— the only item exposed without thestdfeature.Performance, Verified
The performance document records the recorded median for every public reading alongside the raw
std::timecall it forwards to. The wrappers sit on top of the bare std functions inside criterion's noise band on Windows 11 / Rust 1.85.std::timeclock_lib::nowMonotonic::nowSystemClock::nowclock_lib::wallWall::nowclock_lib::elapsedManualClock::nowruns in 752 ps;ManualClock::advance(1ns)in 3.75 ns. A test that calls advance + now a million times spends about 4 ms on the clock.Engineering Posture
#![forbid(unsafe_code)]at the crate root.#![deny(warnings)],clippy::unwrap_used,expect_used,todo,unimplemented,dbg_macro,print_*,unreachable, plus#![warn(clippy::pedantic)].rust-toolchain.tomlpins 1.85.0;Cargo.lockis committed.cargo audit(RustSec) andcargo deny(license + yanked + wildcard policy) run on every push.no_stdbuild onthumbv7em-none-eabihf.Compatibility
no_stdtargets viadefault-features = false.Upgrading From 0.x
Bump the version. There is no code migration.
Out of Scope
clock-libis deliberately small. It does not handle:chronoortime.clock-lib, not be part of it.Stability Promise
Anything documented in docs/API.md is part of the 1.x contract. Behavioral changes that would break correct downstream code will only ship with a major version bump. The crate is feature-complete for its scope; future work is bug fixes, performance refinement, and platform support, not new APIs.
Full Changelog: v0.5.0...v1.0.0
This discussion was created from the release v1.0.0 — Stable API.
Beta Was this translation helpful? Give feedback.
All reactions