bool checkms() { int64 unixms = (myunixtime() - _timeStart) * 1000LL + _msAddToUnixtime; int64 ms = int64(getms(true)); if (ms > unixms + 1000LL) { _msAddToUnixtime = ((ms - unixms) / 1000LL) * 1000LL; } else if (unixms > ms + 1000LL) { _msAddToMsStart += ((unixms - ms) / 1000LL) * 1000LL; if (App::app()) emit App::app()->adjustSingleTimers(); return true; } return false; }
void unixtimeSet(int32 serverTime, bool force) { { QWriteLocker locker(&unixtimeLock); if (force) { DEBUG_LOG(("MTP Info: forced setting client unixtime to %1").arg(serverTime)); } else { if (unixtimeWasSet) return; DEBUG_LOG(("MTP Info: setting client unixtime to %1").arg(serverTime)); } unixtimeWasSet = true; unixtimeDelta = serverTime + 1 - myunixtime(); DEBUG_LOG(("MTP Info: now unixtimeDelta is %1").arg(unixtimeDelta)); } _initMsgIdConstants(); }
int32 unixtime() { int32 result = myunixtime(); QReadLocker locker(&unixtimeLock); return result + unixtimeDelta; }
TimeId unixtime() { TimeId result = myunixtime(); QReadLocker locker(&unixtimeLock); return result + unixtimeDelta; }