pub struct SystemClock { /* private fields */ }Expand description
The default clock: system wall time and a monotonic origin aligned to the process-wide millisecond grid, so default instances share one local expiry grid.
Implementations§
Source§impl SystemClock
impl SystemClock
Sourcepub fn new() -> Self
pub fn new() -> Self
System sources: SystemTime for wall time and the Instant elapsed
since the first default clock of this process for monotonic time.
Sourcepub fn with_sources(
monotonic: impl Fn() -> Duration + Send + Sync + 'static,
wall: impl Fn() -> i64 + Send + Sync + 'static,
) -> Self
pub fn with_sources( monotonic: impl Fn() -> Duration + Send + Sync + 'static, wall: impl Fn() -> i64 + Send + Sync + 'static, ) -> Self
The production alignment over caller-supplied sources.
monotonic reads elapsed time since one fixed instant shared by every
clock built over it; this clock’s origin is the nearest whole
millisecond of that reading at or before construction, so clocks built
at different fractional times share one expiry grid. wall supplies
epoch milliseconds. Controlled tests use this to run the default
alignment over a virtual clock.
Trait Implementations§
Source§impl Clock for SystemClock
impl Clock for SystemClock
Source§impl Clone for SystemClock
impl Clone for SystemClock
Source§fn clone(&self) -> SystemClock
fn clone(&self) -> SystemClock
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SystemClock
impl Debug for SystemClock
Auto Trait Implementations§
impl !RefUnwindSafe for SystemClock
impl !UnwindSafe for SystemClock
impl Freeze for SystemClock
impl Send for SystemClock
impl Sync for SystemClock
impl Unpin for SystemClock
impl UnsafeUnpin for SystemClock
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