Esempio n. 1
0
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;
}
Esempio n. 2
0
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();
}
Esempio n. 3
0
int32 unixtime() {
	int32 result = myunixtime();

	QReadLocker locker(&unixtimeLock);
	return result + unixtimeDelta;
}
Esempio n. 4
0
TimeId unixtime() {
	TimeId result = myunixtime();

	QReadLocker locker(&unixtimeLock);
	return result + unixtimeDelta;
}