pub struct WallTime(/* private fields */);Expand description
Wall-clock instant: nanoseconds since the Unix epoch.
SystemTime-backed under std; a u64 epoch-nanos wrapper under
core + libc (spec §Decisions #2). The portable accessor is
unix_nanos — identical on both builds.
Pre-epoch readings clamp to 0: a clock library must not panic.
REQ-CLK-002.
Implementations§
Source§impl WallTime
impl WallTime
Sourcepub const UNIX_EPOCH: Self
pub const UNIX_EPOCH: Self
The Unix epoch (0 nanos).
Sourcepub const fn from_unix_nanos(ns: u64) -> Self
pub const fn from_unix_nanos(ns: u64) -> Self
Wrap raw epoch nanos.
Sourcepub const fn unix_nanos(&self) -> u64
pub const fn unix_nanos(&self) -> u64
Nanoseconds since the Unix epoch — the identical accessor on every build (std, libc, core-only).
REQ-CLK-002.
Sourcepub fn system(&self) -> SystemTime
pub fn system(&self) -> SystemTime
Reconstruct as std::time::SystemTime (std builds only).
Saturation: absurd values beyond SystemTime’s range collapse to
UNIX_EPOCH rather than panicking.
Sourcepub fn from_system_now() -> Self
pub fn from_system_now() -> Self
Capture the current wall clock (std builds only). Pre-epoch system
clocks clamp to 0.
Trait Implementations§
impl Copy for WallTime
impl Eq for WallTime
Source§impl Ord for WallTime
impl Ord for WallTime
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for WallTime
impl PartialOrd for WallTime
impl StructuralPartialEq for WallTime
Auto Trait Implementations§
impl Freeze for WallTime
impl RefUnwindSafe for WallTime
impl Send for WallTime
impl Sync for WallTime
impl Unpin for WallTime
impl UnsafeUnpin for WallTime
impl UnwindSafe for WallTime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more