Class Timer

Class Documentation

class Timer

Used to time how intervals in code.

Such as how long it takes a given function to run, or how long I/O has taken.

Public Functions

inline Timer()
void start()

Start the timer. Throws an exception if timer was already running.

double stop()

Stop the timer. Throws an exception if timer was already stopped. Calling this adds to the timer’s accumulated time.

Returns:

The accumulated time in seconds.

double accumulated()

Returns the timer’s accumulated time. Throws an exception if the timer is running.

double lap()

Returns the time between when the timer was started and the current moment. Throws an exception if the timer is not running.

inline void reset()

Stops the timer and resets its accumulated time. No exceptions are thrown ever.