Class Timer¶
Defined in File timer.h
Class Documentation¶
-
class Timer¶
Encapsulates basic usage of chrono, providing a means to calculate float durations between time points via function calls.
Public Types
-
using Seconds = std::ratio<1>¶
-
using Milliseconds = std::ratio<1, 1000>¶
-
using Microseconds = std::ratio<1, 1000000>¶
-
using Nanoseconds = std::ratio<1, 1000000000>¶
-
using Clock = std::chrono::steady_clock¶
Public Functions
-
Timer()¶
-
template<typename T = DefaultResolution>
inline float stop()¶ Stops the timer, elapsed() now returns 0.
-
template<typename T = DefaultResolution>
inline float elapsed()¶ Calculates the time difference between now and when the timer was started if lap() was called, then between now and when the timer was last lapped.
- Returns:
The duration between the two time points (default in seconds)
-
template<typename T = DefaultResolution>
inline float tick()¶ Calculates the time difference between now and the last time this function was called.
- Returns:
The duration between the two time points (default in seconds)
-
bool is_running() const¶
Check if the timer is running.
-
using Seconds = std::ratio<1>¶