aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/helpers/Timer.cpp
blob: 33162d30a92139304247b7c2b20fc53fcf99ac9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "Timer.hpp"

void CTimer::reset() {
    m_tpLastReset = std::chrono::system_clock::now();
}

std::chrono::system_clock::duration CTimer::getDuration() {
    return std::chrono::system_clock::now() - m_tpLastReset;
}

int CTimer::getMillis() {
    return std::chrono::duration_cast<std::chrono::milliseconds>(getDuration()).count();
}

float CTimer::getSeconds() {
    return std::chrono::duration_cast<std::chrono::milliseconds>(getDuration()).count() / 1000.f;
}