2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Use server time in dialogs list sorting.

This way it won't mess up when you change your local time.
This commit is contained in:
John Preston
2018-07-31 17:34:14 +03:00
parent f68cefbdc1
commit 9972f7b90e
10 changed files with 47 additions and 42 deletions

View File

@@ -125,6 +125,14 @@ QDateTime ParseDateTime(TimeId serverTime) {
return QDateTime::fromTime_t(serverTime - unixtimeDelta);
}
TimeId ServerTimeFromParsed(const QDateTime &date) {
if (date.isNull()) {
return TimeId(0);
}
QReadLocker locker(&unixtimeLock);
return date.toTime_t() + unixtimeDelta;
}
// Precise timing functions / rand init
struct CRYPTO_dynlock_value {

View File

@@ -196,6 +196,7 @@ uint64 msgid();
int GetNextRequestId();
QDateTime ParseDateTime(TimeId serverTime);
TimeId ServerTimeFromParsed(const QDateTime &date);
inline void mylocaltime(struct tm * _Tm, const time_t * _Time) {
#ifdef Q_OS_WIN