Use crl::time/now instead of TimeMs/getms.

This commit is contained in:
John Preston
2019-02-19 10:57:53 +04:00
parent d208236994
commit fe618bd652
310 changed files with 1133 additions and 1141 deletions
+8 -8
View File
@@ -40,7 +40,7 @@ Timer::Timer(Fn<void()> callback)
Qt::QueuedConnection);
}
void Timer::start(TimeMs timeout, Qt::TimerType type, Repeat repeat) {
void Timer::start(crl::time timeout, Qt::TimerType type, Repeat repeat) {
cancel();
_type = type;
@@ -49,7 +49,7 @@ void Timer::start(TimeMs timeout, Qt::TimerType type, Repeat repeat) {
setTimeout(timeout);
_timerId = startTimer(_timeout, _type);
if (_timerId) {
_next = crl::time() + _timeout;
_next = crl::now() + _timeout;
} else {
_next = 0;
}
@@ -61,12 +61,12 @@ void Timer::cancel() {
}
}
TimeMs Timer::remainingTime() const {
crl::time Timer::remainingTime() const {
if (!isActive()) {
return -1;
}
auto now = crl::time();
return (_next > now) ? (_next - now) : TimeMs(0);
const auto now = crl::now();
return (_next > now) ? (_next - now) : crl::time(0);
}
void Timer::Adjust() {
@@ -87,7 +87,7 @@ void Timer::adjust() {
}
}
void Timer::setTimeout(TimeMs timeout) {
void Timer::setTimeout(crl::time timeout) {
Expects(timeout >= 0 && timeout <= std::numeric_limits<int>::max());
_timeout = static_cast<unsigned int>(timeout);
@@ -102,7 +102,7 @@ void Timer::timerEvent(QTimerEvent *e) {
if (_adjusted) {
start(_timeout, _type, repeat());
} else {
_next = crl::time() + _timeout;
_next = crl::now() + _timeout;
}
} else {
cancel();
@@ -114,7 +114,7 @@ void Timer::timerEvent(QTimerEvent *e) {
}
int DelayedCallTimer::call(
TimeMs timeout,
crl::time timeout,
FnMut<void()> callback,
Qt::TimerType type) {
Expects(timeout >= 0);