Struct cap_primitives::time::MonotonicClock
source · pub struct MonotonicClock(_);
Expand description
A reference to a monotonically nondecreasing clock.
This does not directly correspond to anything in std
, however its methods
correspond to methods in std::time::Instant
.
Implementations§
source§impl MonotonicClock
impl MonotonicClock
sourcepub const fn new(_: AmbientAuthority) -> Self
pub const fn new(_: AmbientAuthority) -> Self
Constructs a new instance of Self
.
Ambient Authority
This uses ambient authority to accesses clocks.
sourcepub fn now(&self) -> Instant
pub fn now(&self) -> Instant
Returns an instant corresponding to “now”.
This corresponds to std::time::Instant::now
.
sourcepub fn elapsed(&self, instant: Instant) -> Duration
pub fn elapsed(&self, instant: Instant) -> Duration
Returns the amount of time elapsed since this instant was created.
This corresponds to std::time::Instant::elapsed
.