2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-07 01:45:39 +00:00

Isolate lib_base library. Use crl::time in getms.

This commit is contained in:
John Preston
2018-08-08 23:11:28 +03:00
parent cb371f09ac
commit 64b8adb3d0
23 changed files with 267 additions and 157 deletions

View File

@@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "base/timer.h"
#include <QtCore/QTimerEvent>
namespace base {
namespace {
@@ -48,7 +50,7 @@ void Timer::start(TimeMs timeout, Qt::TimerType type, Repeat repeat) {
setTimeout(timeout);
_timerId = startTimer(_timeout, _type);
if (_timerId) {
_next = getms(true) + _timeout;
_next = crl::time() + _timeout;
} else {
_next = 0;
}
@@ -64,7 +66,7 @@ TimeMs Timer::remainingTime() const {
if (!isActive()) {
return -1;
}
auto now = getms(true);
auto now = crl::time();
return (_next > now) ? (_next - now) : TimeMs(0);
}
@@ -101,7 +103,7 @@ void Timer::timerEvent(QTimerEvent *e) {
if (_adjusted) {
start(_timeout, _type, repeat());
} else {
_next = getms(true) + _timeout;
_next = crl::time() + _timeout;
}
} else {
cancel();