Struct chroniker::Timer
[−]
[src]
pub struct Timer { /* fields omitted */ }
Methods
impl Timer
[src]
fn new() -> Timer
fn elapsed_millis(&self) -> u64
Returns the amount of milliseconds since the timer was created or reset.
Examples
let timer = timer::new();
Now lets do some operations
chroniker::sleep(1000);
Now lets check out the total time passed. This will print 1000 or 1001
let elapsed_millis = timer.elapsed_millis(); println!("Timer: {}", elapsed_millis);
fn reset(&mut self)
Resets thes timer to 0 and starts counting up again.
Examples
let mut timer = timer::new(); chroniker::sleep(1000);
Now lets check out the total time passed. This will print 1000 or 1001
let elapsed_millis = timer.elapsed_millis(); println!("Timer: {}", elapsed_millis);
However, if you reset it and then print out the results, the program will output 0.000.
timer.reset(); println!("Timer: {:?}", timer);