mirror of
https://github.com/JS8Call-improved/JS8Call-improved
synced 2026-08-13 17:47:36 -04:00
51 lines
No EOL
778 B
C++
51 lines
No EOL
778 B
C++
#include "DriftingDateTime.h"
|
|
|
|
namespace
|
|
{
|
|
qint64 driftMS = 0;
|
|
}
|
|
|
|
namespace DriftingDateTime
|
|
{
|
|
qint64
|
|
drift()
|
|
{
|
|
return driftMS;
|
|
}
|
|
|
|
void
|
|
setDrift(qint64 const ms)
|
|
{
|
|
driftMS = ms;
|
|
}
|
|
|
|
qint64
|
|
incrementDrift(qint64 const msDelta)
|
|
{
|
|
return driftMS += msDelta;
|
|
}
|
|
|
|
QDateTime
|
|
currentDateTime()
|
|
{
|
|
return QDateTime::currentDateTime().addMSecs(driftMS);
|
|
}
|
|
|
|
QDateTime
|
|
currentDateTimeUtc()
|
|
{
|
|
return QDateTime::currentDateTimeUtc().addMSecs(driftMS);
|
|
}
|
|
|
|
qint64
|
|
currentMSecsSinceEpoch()
|
|
{
|
|
return QDateTime::currentMSecsSinceEpoch() + driftMS;
|
|
}
|
|
|
|
qint64
|
|
currentSecsSinceEpoch()
|
|
{
|
|
return currentMSecsSinceEpoch() / 1000;
|
|
}
|
|
} |