pub struct ClockRate { /* private fields */ }Expand description
Time measuring device.
Uses system monotonic clock counter
and yields ClockSteps for each step.
Rate can be set to control the speed of the clock.
Implementations§
Source§impl ClockRate
impl ClockRate
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Resets the clock. Sets start to the given instant. And set clocks to start.
Sourcepub fn set_rate_ratio(&mut self, nom: u64, denom: NonZeroU64)
pub fn set_rate_ratio(&mut self, nom: u64, denom: NonZeroU64)
Set rate to specified ratio.
Sourcepub fn with_rate_ratio(self, nom: u64, denom: NonZeroU64) -> Self
pub fn with_rate_ratio(self, nom: u64, denom: NonZeroU64) -> Self
Set rate to specified ratio.
Sourcepub fn rate_ratio(&mut self) -> (u64, NonZeroU64)
pub fn rate_ratio(&mut self) -> (u64, NonZeroU64)
Returns current rate ratio.
Sourcepub fn step(&mut self, span: TimeSpan) -> ClockStep
pub fn step(&mut self, span: TimeSpan) -> ClockStep
Advances the clock by given time span and returns ClockStep result.
with new time stamp and time span since previous step.
pub fn ticker(&self, freq: Frequency) -> FrequencyTicker
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClockRate
impl RefUnwindSafe for ClockRate
impl Send for ClockRate
impl Sync for ClockRate
impl Unpin for ClockRate
impl UnwindSafe for ClockRate
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