time.timer

Timer struct.

struct Timer;

A timer struct; handles timing of various delayed or periodic events.

this(const(real) delay);

Constructs a timer starting now.

Parameters:
const(real) delay Delay of the timer.
this(const(real) delay, const(real) start);

Constructs a timer starting at specified time.

Parameters:
const(real) delay Delay of the timer.
time Start time of the timer.
const pure @property real start();

Get time when the timer was started.

const pure @property real delay();

Get delay of this timer.

const pure @property real age(const real time);

Returns time since start of the timer at specified time.

Parameters:
real time Time relative to which to calculate the age.
Returns:
Age of the timer relative to specified time.
const @property real age();

Returns time since start of the timer.

const pure @property real ageRelative(const real time);

Returns time since start of the timer at specified time divided by the timer's delay.

Parameters:
real time Time relative to which to calculate the age.
Returns:
Age of the timer relative to specified time divided by the delay. This is 0.0 at the start of the timer, and 1.0 at its end, so it can be used to get percentage of timer's delay that has elapsed.
const @property real ageRelative();

Returns time since start of the timer divided by the timer's delay.

Returns:
Age of the timer divided by the delay. This is 0.0 at the start of the timer, and 1.0 at its end, so it can be used to get percentage of timer's delay that has elapsed.
const pure bool expired(const real time);

Determines if the timer has expired at specified time.

Parameters:
real time Time relative to which to check for expiration.
Returns:
True if the timer has expired, false otherwise.
const bool expired();

Determines if the timer has expired.

pure void reset(const real start);

Resets the timer with specified start time.

void reset();

Resets the timer.