pub struct SystemClock { /* private fields */ }Expand description
The control plane’s name for TokioClock, kept so control::SystemClock::new() and
SystemClock::default() still resolve.
The production clock: tokio’s monotonic clock and the system’s wall clock.
tokio’s rather than std’s for a reason that is easy to get backwards: under a
deterministic simulator the tokio clock is virtual and std::time::Instant isn’t, so a
sixty-minute boundary crossed in simulated time is invisible to std. A client that timed
its token or its launch wait against std::time::Instant would pass a long simulation
without ever re-minting or timing out. Outside a runtime whose clock is paused, which only
a simulator or a test sets up, tokio::time::Instant::now() is the std monotonic clock, so
production behavior is the same as it was over std.
The wall reading stays on SystemTime under a simulator. Nothing times a deadline on it.
Implementations§
Source§impl TokioClock
impl TokioClock
pub fn new() -> TokioClock
Trait Implementations§
Source§impl Clock for TokioClock
impl Clock for TokioClock
Source§impl Debug for TokioClock
impl Debug for TokioClock
Source§impl Default for TokioClock
impl Default for TokioClock
Source§fn default() -> TokioClock
fn default() -> TokioClock
Auto Trait Implementations§
impl Freeze for TokioClock
impl RefUnwindSafe for TokioClock
impl Send for TokioClock
impl Sync for TokioClock
impl Unpin for TokioClock
impl UnsafeUnpin for TokioClock
impl UnwindSafe for TokioClock
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
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> ⓘ
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> ⓘ
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