Util: Add pause() and resume() to Timer
This commit is contained in:
+7
-4
@@ -11,13 +11,14 @@ using TimePoint = std::chrono::high_resolution_clock::time_point;
|
||||
class Timer {
|
||||
public:
|
||||
Timer();
|
||||
Timer(const TimePoint& timePoint)
|
||||
: m_start(timePoint)
|
||||
{
|
||||
}
|
||||
Timer(const TimePoint& timePoint);
|
||||
|
||||
Timer operator-(const Timer& timer);
|
||||
|
||||
static TimePoint now();
|
||||
void pause();
|
||||
void resume();
|
||||
|
||||
template<typename To, typename From>
|
||||
To to(From from);
|
||||
uint64_t toSeconds();
|
||||
@@ -37,6 +38,8 @@ public:
|
||||
const TimePoint& start() const { return m_start; }
|
||||
|
||||
private:
|
||||
bool m_running { true };
|
||||
TimePoint m_accumulated;
|
||||
TimePoint m_start;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user