pub struct SystemClock;Expand description
Production clock backed by the operating system.
use weavegraph::utils::clock::{Clock, SystemClock};
assert!(SystemClock.now() > 0);Trait Implementations§
Source§impl Clock for SystemClock
impl Clock for SystemClock
Source§fn now_datetime(&self) -> DateTime<Utc>
fn now_datetime(&self) -> DateTime<Utc>
Current time as a
DateTime<Utc>.Source§fn now_system_time(&self) -> SystemTime
fn now_system_time(&self) -> SystemTime
Current time as a
SystemTime for interop with the standard library.Source§fn now_unix_ms(&self) -> i64
fn now_unix_ms(&self) -> i64
Current time as milliseconds since the Unix epoch.
Source§fn has_elapsed(&self, since: u64, duration: Duration) -> bool
fn has_elapsed(&self, since: u64, duration: Duration) -> bool
Returns
true if at least duration has elapsed since since.Source§fn duration_since(&self, timestamp: u64) -> Duration
fn duration_since(&self, timestamp: u64) -> Duration
Elapsed time since
timestamp, saturating at zero.Source§impl Clone for SystemClock
impl Clone for SystemClock
impl Copy for SystemClock
Source§impl Debug for SystemClock
impl Debug for SystemClock
Auto Trait Implementations§
impl Freeze for SystemClock
impl RefUnwindSafe for SystemClock
impl Send for SystemClock
impl Sync for SystemClock
impl Unpin for SystemClock
impl UnsafeUnpin for SystemClock
impl UnwindSafe 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more