mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +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:
@@ -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 {
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user