Skip to main content

Crate atomic_time

Crate atomic_time 

Source
Expand description

Atomic time types.

All types are thread-safe and use portable_atomic::AtomicU128 under the hood. Operations are lock-free on platforms with native AtomicU128 support; otherwise, portable-atomic may fall back to a global lock. Each type exposes an is_lock_free method to query the behavior of the current target.

The std feature controls the SystemTime and Instant types. Disable it for no_std builds to use the duration types without the standard library.

The optional arbitrary, quickcheck, and proptest features provide fuzzing and property-testing support for the duration and system-time atomic types. All three require std: the current upstream arbitrary v1 crate itself requires std. quickcheck additionally implements Clone as a SeqCst snapshot: when another thread writes concurrently, the clone is the value observed at its atomic linearization point.

AtomicInstant and AtomicOptionInstant intentionally do not implement these generation traits. Their values use a process-local baseline and cannot be generated from a deterministic, portable cross-run corpus.

Modules§

utils
Utility functions for encoding and decoding core::time::Duration values.

Structs§

AtomicDuration
Atomic version of Duration
AtomicInstantstd
Atomic version of Instant.
AtomicOptionDuration
Atomic version of Option<Duration>.
AtomicOptionInstantstd
Atomic version of Option<Instant>.
AtomicOptionSystemTimestd
An atomic version of Option<std::time::SystemTime>.
AtomicSystemTimestd
An atomic version of std::time::SystemTime.

Enums§

Ordering
Atomic memory orderings