core: move to steady_clock where applicable
avoid issues when system clock gets desynchronized or changed
This commit is contained in:
parent
918d8340af
commit
1d70962892
10 changed files with 31 additions and 31 deletions
|
|
@ -1,11 +1,11 @@
|
|||
#include "Timer.hpp"
|
||||
|
||||
void CTimer::reset() {
|
||||
m_tpLastReset = std::chrono::system_clock::now();
|
||||
m_tpLastReset = std::chrono::steady_clock::now();
|
||||
}
|
||||
|
||||
std::chrono::system_clock::duration CTimer::getDuration() {
|
||||
return std::chrono::system_clock::now() - m_tpLastReset;
|
||||
std::chrono::steady_clock::duration CTimer::getDuration() {
|
||||
return std::chrono::steady_clock::now() - m_tpLastReset;
|
||||
}
|
||||
|
||||
int CTimer::getMillis() {
|
||||
|
|
@ -16,6 +16,6 @@ float CTimer::getSeconds() {
|
|||
return std::chrono::duration_cast<std::chrono::milliseconds>(getDuration()).count() / 1000.f;
|
||||
}
|
||||
|
||||
const std::chrono::system_clock::time_point& CTimer::chrono() const {
|
||||
const std::chrono::steady_clock::time_point& CTimer::chrono() const {
|
||||
return m_tpLastReset;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue