fix uptime calculation when client and core are in different timezones
authorDaniel Albers <daniel@lbers.com>
Wed, 17 Sep 2008 15:55:47 +0000 (17:55 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Fri, 19 Sep 2008 11:58:38 +0000 (13:58 +0200)
src/core/core.cpp
src/qtui/coreinfodlg.cpp

index 87193bc..4d555cf 100644 (file)
@@ -50,7 +50,7 @@ void Core::destroy() {
 }
 
 Core::Core() : storage(0) {
 }
 
 Core::Core() : storage(0) {
-  _startTime = QDateTime::currentDateTime();  // for uptime :)
+  _startTime = QDateTime::currentDateTime().toUTC();  // for uptime :)
 
   // Register storage backends here!
   registerStorageBackend(new SqliteStorage(this));
 
   // 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
     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;
     int updays = uptime / 86400; uptime %= 86400;
     int uphours = uptime / 3600; uptime %= 3600;
     int upmins = uptime / 60;
index f367c03..6c5d6fa 100644 (file)
@@ -43,7 +43,7 @@ void CoreInfoDlg::coreInfoAvailable() {
 void CoreInfoDlg::updateUptime() {
   QDateTime startTime = _coreInfo["startTime"].toDateTime();
   
 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;
   int updays = uptime / 86400; uptime %= 86400;
   int uphours = uptime / 3600; uptime %= 3600;
   int upmins = uptime / 60; uptime %= 60;