Use system_clock in usecTimestampNow for cross-platform goodness

This commit is contained in:
Simon Walton 2018-08-30 17:12:42 -07:00
parent b45b0f54e4
commit 33db1394e6

View file

@ -134,7 +134,8 @@ void usecTimestampNowForceClockSkew(qint64 clockSkew) {
quint64 usecTimestampNow(bool wantDebug) {
using namespace std::chrono;
return duration_cast<microseconds>(high_resolution_clock::now().time_since_epoch()).count();
static const auto unixEpoch = system_clock::from_time_t(0);
return duration_cast<microseconds>(system_clock::now() - unixEpoch).count();
#if 0
std::call_once(usecTimestampNowIsInitialized, [&] {
TIME_REFERENCE = QDateTime::currentMSecsSinceEpoch() * USECS_PER_MSEC; // ms to usec