fix uptime calculation when client and core are in different timezones
[quassel.git] / src / core / core.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;