Struct chroniker::Timer [] [src]

pub struct Timer { /* fields omitted */ }

Methods

impl Timer
[src]

Creates and starts the timer.

Examples

let timer = Timer::new();

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);

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);

Trait Implementations

impl Debug for Timer
[src]

Prints out the time.

Format

If the time is 1500 milliseconds (1.5 seconds) it will print out

$ 1.500

If the time is 75699 milliseconds (1 minute, 15 seconds, and 699 milliseconds) it will print out

$ 1:15.699