SPH
|
Basic time-measuring tool. Starts automatically when constructed. More...
#include <Timer.h>
Public Member Functions | |
Timer (const int64_t interval=0, const Flags< TimerFlags > flags=EMPTY_FLAGS) | |
Creates timer with given expiration duration. More... | |
void | restart () |
Reset elapsed duration to zero. More... | |
int64_t | elapsed (const TimerUnit unit) const |
Returns elapsed time in timer units. Does not reset the timer. More... | |
bool | isExpired () const |
Checks if the interval has already passed. More... | |
bool | isPeriodic () const |
Protected Types | |
using | Clock = std::chrono::system_clock |
using | TimePoint = std::chrono::time_point< Clock > |
Protected Attributes | |
TimePoint | started |
int64_t | interval |
Flags< TimerFlags > | flags |
Basic time-measuring tool. Starts automatically when constructed.
|
protected |
|
protected |
Timer::Timer | ( | const int64_t | interval = 0 , |
const Flags< TimerFlags > | flags = EMPTY_FLAGS |
||
) |
Creates timer with given expiration duration.
Flag TimerFlags::PERIODIC does not do anything in this case, user must check for expiration and possibly restart timer, this isn't provided by timer constructed this way.
interval | Timer interval in milliseconds. It isn't currently possible to create interval in different units. |
flags | Optional parameters of the timer, see TimerFlags. |
int64_t Timer::elapsed | ( | const TimerUnit | unit | ) | const |
|
inline |
|
protected |