summaryrefslogtreecommitdiff
path: root/src/helpers/time/Timer.cpp
blob: 95f754410e288193b5f61d9daa331129c763e26a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "Timer.hpp"

#define chr std::chrono

void CTimer::reset() {
    m_lastReset = Time::steadyNow();
}

Time::steady_dur CTimer::getDuration() {
    return Time::steadyNow() - m_lastReset;
}

float CTimer::getMillis() {
    return chr::duration_cast<chr::microseconds>(getDuration()).count() / 1000.F;
}

float CTimer::getSeconds() {
    return chr::duration_cast<chr::milliseconds>(getDuration()).count() / 1000.F;
}

const Time::steady_tp& CTimer::chrono() const {
    return m_lastReset;
}