mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 15:03:19 +02:00
Merge branch 'master' of https://github.com/worklist/hifi into fixtimestamps
Conflicts: libraries/shared/src/SharedUtil.cpp
This commit is contained in:
commit
7c1b5ba092
5 changed files with 10 additions and 23 deletions
|
@ -17,8 +17,6 @@
|
|||
#include "AssignmentClientMonitor.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
initialiseUsecTimestampNow();
|
||||
|
||||
#ifndef WIN32
|
||||
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||
#endif
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#include "DomainServer.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
initialiseUsecTimestampNow();
|
||||
|
||||
#ifndef WIN32
|
||||
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||
#endif
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include <SharedUtil.h>
|
||||
|
||||
int main(int argc, const char * argv[]) {
|
||||
initialiseUsecTimestampNow();
|
||||
QElapsedTimer startupTime;
|
||||
startupTime.start();
|
||||
|
||||
|
|
|
@ -30,29 +30,22 @@
|
|||
#include "OctalCode.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
|
||||
static qint64 TIME_REFERENCE = 0; // in usec
|
||||
static QElapsedTimer timestampTimer;
|
||||
static int usecTimestampNowAdjust = 0; // in usec
|
||||
|
||||
void initialiseUsecTimestampNow() {
|
||||
static bool initialised = false;
|
||||
if (initialised) {
|
||||
qDebug() << "[WARNING] Double initialisation of usecTimestampNow().";
|
||||
return;
|
||||
}
|
||||
|
||||
TIME_REFERENCE = QDateTime::currentMSecsSinceEpoch() * 1000; // ms to usec
|
||||
timestampTimer.start();
|
||||
initialised = true;
|
||||
qDebug() << "[INFO] usecTimestampNow() initialized.";
|
||||
}
|
||||
|
||||
void usecTimestampNowForceClockSkew(int clockSkew) {
|
||||
::usecTimestampNowAdjust = clockSkew;
|
||||
}
|
||||
|
||||
quint64 usecTimestampNow() {
|
||||
static bool usecTimestampNowIsInitialized = false;
|
||||
static qint64 TIME_REFERENCE = 0; // in usec
|
||||
static QElapsedTimer timestampTimer;
|
||||
|
||||
if (!usecTimestampNowIsInitialized) {
|
||||
TIME_REFERENCE = QDateTime::currentMSecsSinceEpoch() * 1000; // ms to usec
|
||||
timestampTimer.start();
|
||||
usecTimestampNowIsInitialized = true;
|
||||
}
|
||||
|
||||
// usec nsec to usec usec
|
||||
return TIME_REFERENCE + timestampTimer.nsecsElapsed() / 1000 + ::usecTimestampNowAdjust;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@ static const quint64 USECS_PER_SECOND = USECS_PER_MSEC * MSECS_PER_SECOND;
|
|||
|
||||
const int BITS_IN_BYTE = 8;
|
||||
|
||||
void initialiseUsecTimestampNow();
|
||||
quint64 usecTimestampNow();
|
||||
void usecTimestampNowForceClockSkew(int clockSkew);
|
||||
|
||||
|
|
Loading…
Reference in a new issue