|
QuasarEngine
Cross-platform 3D engine and editor
|
High-resolution (steady) timer that measures the time elapsed since it was created or last reset. More...
#include <quasar/core/Timer.h>
Public Types | |
| using | Clock = std::chrono::steady_clock |
| Clock used by the timer, monotonic with nanosecond resolution. | |
Public Member Functions | |
| Timer () | |
| Creates a timer that starts measuring right away. | |
| void | Reset () |
| Resets the timer to zero. | |
| double | ElapsedSeconds () const |
| Returns the time elapsed since the timer was created or last reset, in seconds. | |
| double | ElapsedMilliseconds () const |
| Returns the time elapsed since the timer was created or last reset, in milliseconds. | |
High-resolution (steady) timer that measures the time elapsed since it was created or last reset.
It relies on a monotonic clock, so changes to the system time do not affect it.
Timer timer; LoadScene(); double ms = timer.ElapsedMilliseconds();
| using Quasar::Timer::Clock = std::chrono::steady_clock |
Clock used by the timer, monotonic with nanosecond resolution.
std::chrono::high_resolution_clock is not used on purpose: it is an alias whose target depends on the standard library, and with libstdc++ it is the system clock, which is not monotonic.
| double Quasar::Timer::ElapsedSeconds | ( | ) | const |
Returns the time elapsed since the timer was created or last reset, in seconds.
| double Quasar::Timer::ElapsedMilliseconds | ( | ) | const |
Returns the time elapsed since the timer was created or last reset, in milliseconds.