Struct timer_controller::Timer [] [src]

pub struct Timer {
    pub interval: f64,
    pub time: f64,
    pub next: f64,
}

A timer relative to start of program.

Fields

interval: f64

The interval in seconds between each trigger.

time: f64

The time in seconds from start of program.

next: f64

The time of next trigger in seconds.

Methods

impl Timer
[src]

fn new(interval: f64) -> Timer

Creates a new timer.

fn event<E: GenericEvent, F: FnMut()>(&mut self, e: &E, f: F)

Calls closure for each interval to catch up with update time.

The timing is inaccurate for less intervals than the update interval.