From 41dd93ccb2696dced0e27e213ee7a3a75c9044a8 Mon Sep 17 00:00:00 2001 From: Daniel Albers Date: Wed, 17 Sep 2008 17:55:47 +0200 Subject: [PATCH 1/1] fix uptime calculation when client and core are in different timezones --- src/core/core.cpp | 4 ++-- src/qtui/coreinfodlg.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/core.cpp b/src/core/core.cpp index 87193bca..4d555cfc 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -50,7 +50,7 @@ void Core::destroy() { } Core::Core() : storage(0) { - _startTime = QDateTime::currentDateTime(); // for uptime :) + _startTime = QDateTime::currentDateTime().toUTC(); // for uptime :) // Register storage backends here! registerStorageBackend(new SqliteStorage(this)); @@ -430,7 +430,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) { reply["CoreBuild"] = 860; // FIXME legacy reply["ProtocolVersion"] = Global::protocolVersion; // TODO: Make the core info configurable - int uptime = startTime().secsTo(QDateTime::currentDateTime()); + int uptime = startTime().secsTo(QDateTime::currentDateTime().toUTC()); int updays = uptime / 86400; uptime %= 86400; int uphours = uptime / 3600; uptime %= 3600; int upmins = uptime / 60; diff --git a/src/qtui/coreinfodlg.cpp b/src/qtui/coreinfodlg.cpp index f367c03d..6c5d6fad 100644 --- a/src/qtui/coreinfodlg.cpp +++ b/src/qtui/coreinfodlg.cpp @@ -43,7 +43,7 @@ void CoreInfoDlg::coreInfoAvailable() { void CoreInfoDlg::updateUptime() { QDateTime startTime = _coreInfo["startTime"].toDateTime(); - int uptime = startTime.secsTo(QDateTime::currentDateTime()); + int uptime = startTime.secsTo(QDateTime::currentDateTime().toUTC()); int updays = uptime / 86400; uptime %= 86400; int uphours = uptime / 3600; uptime %= 3600; int upmins = uptime / 60; uptime %= 60; -- 2.20.1