#[repr(C)]pub struct Clock { /* private fields */ }
Expand description
Utility type that measures the elapsed time.
Its provides the most precise time that the underlying OS can achieve (generally microseconds or nanoseconds). It also ensures monotonicity, which means that the returned time can never go backward, even if the system time is changed.
Usage example
let mut clock = Clock::start();
// ...
let time1 = clock.elapsed_time();
// ...
let time2 = clock.restart();
The Time
value returned by the clock can then be converted to
a number of seconds, milliseconds or even microseconds.
Implementations
sourceimpl Clock
impl Clock
sourcepub fn elapsed_time(&self) -> Time
pub fn elapsed_time(&self) -> Time
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for sfClock
impl Send for sfClock
impl Sync for sfClock
impl Unpin for sfClock
impl UnwindSafe for sfClock
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more