[−][src]Struct sfml::system::Clock
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.
Methods
impl Clock[src]
pub fn start() -> Clock[src]
Creates a new Clock and starts it automatically.
pub fn elapsed_time(&self) -> Time[src]
Gets the elapsed time.
This function returns the time elapsed since the last call to restart
(or the construction of the instance if restart has not been called).
pub fn restart(&mut self) -> Time[src]
Restarts the clock.
This function puts the time counter back to zero. It also returns the time elapsed since the clock was started.
Trait Implementations
impl Drop for Clock[src]
impl Clone for Clock[src]
fn clone(&self) -> Self[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Default for Clock[src]
impl Debug for Clock[src]
Auto Trait Implementations
impl !Send for Clock
impl !Sync for Clock
impl Unpin for Clock
impl UnwindSafe for Clock
impl RefUnwindSafe for Clock
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,