mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 09:24:00 +02:00
Use std::chrono for usecTimestampNow()
This commit is contained in:
parent
9711076dae
commit
a186be014d
1 changed files with 5 additions and 0 deletions
|
@ -21,6 +21,7 @@
|
|||
#include <thread>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <chrono>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
|
@ -132,6 +133,9 @@ static std::once_flag usecTimestampNowIsInitialized;
|
|||
static QElapsedTimer timestampTimer;
|
||||
|
||||
quint64 usecTimestampNow(bool wantDebug) {
|
||||
using namespace std::chrono;
|
||||
return duration_cast<microseconds>(high_resolution_clock::now().time_since_epoch()).count();
|
||||
#if 0
|
||||
std::call_once(usecTimestampNowIsInitialized, [&] {
|
||||
TIME_REFERENCE = QDateTime::currentMSecsSinceEpoch() * USECS_PER_MSEC; // ms to usec
|
||||
timestampTimer.start();
|
||||
|
@ -203,6 +207,7 @@ quint64 usecTimestampNow(bool wantDebug) {
|
|||
}
|
||||
|
||||
return now;
|
||||
#endif
|
||||
}
|
||||
|
||||
float secTimestampNow() {
|
||||
|
|
Loading…
Reference in a new issue