pub struct StdClock { /* private fields */ }Expand description
Clock backed by the operating system’s clocks.
Monotonic time is measured from an Instant epoch captured when the clock
is created, so monotonic_ms starts near zero and cannot go backwards.
Wall-clock time comes from SystemTime and can jump in either direction
as the system clock is adjusted, which is exactly why the two are reported
separately; a system clock set before the Unix epoch reports no wall-clock
time at all rather than a nonsense timestamp.
§Example
use minip2p_platform::{Clock, StdClock};
let mut clock = StdClock::new();
let start = clock.now();
let later = clock.now();
assert!(later.monotonic_ms >= start.monotonic_ms);Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StdClock
impl RefUnwindSafe for StdClock
impl Send for StdClock
impl Sync for StdClock
impl Unpin for StdClock
impl UnsafeUnpin for StdClock
impl UnwindSafe for StdClock
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