2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

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

View File

@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h"
#include "data/data_user.h"
#include "base/timer.h"
#include "base/concurrent_timer.h"
#include "core/update_checker.h"
#include "core/shortcuts.h"
#include "core/sandbox.h"
@@ -630,8 +631,13 @@ void Application::forceLogOut(const TextWithEntities &explanation) {
}
void Application::checkLocalTime() {
const auto updated = checkms();
if (App::main()) App::main()->checkLastUpdate(updated);
if (crl::adjust_time()) {
base::Timer::Adjust();
base::ConcurrentTimerEnvironment::Adjust();
if (App::main()) App::main()->checkLastUpdate(true);
} else {
if (App::main()) App::main()->checkLastUpdate(false);
}
}
void Application::stateChanged(Qt::ApplicationState state) {

View File

@@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Core {
constexpr auto kHandleSrpIdInvalidTimeout = 60 * TimeMs(1000);
constexpr auto kHandleSrpIdInvalidTimeout = 60 * crl::time(1000);
struct CloudPasswordAlgoModPow {
static constexpr auto kIterations = 100000;

View File

@@ -36,7 +36,7 @@ extern "C" {
namespace Core {
namespace {
constexpr auto kUpdaterTimeout = 10 * TimeMs(1000);
constexpr auto kUpdaterTimeout = 10 * crl::time(1000);
constexpr auto kMaxResponseSize = 1024 * 1024;
#ifdef TDESKTOP_DISABLE_AUTOUPDATE
@@ -1227,7 +1227,7 @@ void Updater::start(bool forceWait) {
_checking.fire({});
} else {
_timer.callOnce((updateInSecs + 5) * TimeMs(1000));
_timer.callOnce((updateInSecs + 5) * crl::time(1000));
}
}

View File

@@ -8,8 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/utils.h"
#include "base/qthelp_url.h"
#include "base/timer.h"
#include "base/concurrent_timer.h"
#include "platform/platform_specific.h"
extern "C" {
@@ -226,7 +224,7 @@ namespace {
timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
const auto seed = 1000LL * static_cast<TimeMs>(ts.tv_sec) + (static_cast<TimeMs>(ts.tv_nsec) / 1000000LL);
const auto seed = 1000LL * static_cast<crl::time>(ts.tv_sec) + (static_cast<crl::time>(ts.tv_nsec) / 1000000LL);
#endif
srand((uint32)(seed & 0xFFFFFFFFL));
}
@@ -431,19 +429,6 @@ namespace ThirdParty {
}
}
bool checkms() {
if (crl::adjust_time()) {
base::Timer::Adjust();
base::ConcurrentTimerEnvironment::Adjust();
return true;
}
return false;
}
TimeMs getms(bool checked) {
return crl::time();
}
uint64 msgid() {
#ifdef Q_OS_WIN
LARGE_INTEGER li;

View File

@@ -161,10 +161,7 @@ namespace ThirdParty {
void start();
void finish();
}
bool checkms(); // returns true if time has changed
TimeMs getms(bool checked = false);
} // namespace ThirdParty
const static uint32 _md5_block_size = 64;
class HashMd5 {
@@ -324,7 +321,7 @@ struct ProxyData {
QString user, password;
std::vector<QString> resolvedIPs;
TimeMs resolvedExpireAt = 0;
crl::time resolvedExpireAt = 0;
bool valid() const;
bool supportsCalls() const;