QuasarEngine
Cross-platform 3D engine and editor
Loading...
Searching...
No Matches
Timer.h
Go to the documentation of this file.
1#pragma once
2
7
8#include <chrono>
9
10namespace Quasar
11{
17
18 class Timer
19 {
20 public:
25 using Clock = std::chrono::steady_clock;
26
28 Timer() { Reset(); }
29
31 void Reset();
32
35 double ElapsedSeconds() const;
36
39 double ElapsedMilliseconds() const;
40
41 private:
42 Clock::time_point m_Start;
43 };
44}
double ElapsedSeconds() const
Returns the time elapsed since the timer was created or last reset, in seconds.
Timer()
Creates a timer that starts measuring right away.
Definition Timer.h:28
std::chrono::steady_clock Clock
Clock used by the timer, monotonic with nanosecond resolution.
Definition Timer.h:25
void Reset()
Resets the timer to zero.
double ElapsedMilliseconds() const
Returns the time elapsed since the timer was created or last reset, in milliseconds.
Contains all the engine code.