From: Manuel Nickschas Date: Sun, 7 Apr 2013 22:22:18 +0000 (+0200) Subject: Fix lag display X-Git-Tag: 0.9-rc1~6 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=34aa0106620836d360f2deebaa8d88ef52ba1a7e Fix lag display Not sure what I was thinking in d3ce95c, but that commit a) didn't fix compiling with Qt < 4.7 b) confused local time and UTC, which c) completely bugged lag display. Should be working now. --- diff --git a/src/common/protocols/legacy/legacypeer.cpp b/src/common/protocols/legacy/legacypeer.cpp index d0000473..0f9c61e0 100644 --- a/src/common/protocols/legacy/legacypeer.cpp +++ b/src/common/protocols/legacy/legacypeer.cpp @@ -208,7 +208,7 @@ void LegacyPeer::handlePackedFunc(const QVariant &packedFunc) } // The legacy protocol would only send a QTime, no QDateTime // so we assume it's sent today, which works in exactly the same cases as it did in the old implementation - QDateTime dateTime = QDateTime::currentDateTimeUtc(); + QDateTime dateTime = QDateTime::currentDateTime().toUTC(); dateTime.setTime(params[0].toTime()); handle(Protocol::HeartBeat(dateTime)); break; @@ -220,7 +220,7 @@ void LegacyPeer::handlePackedFunc(const QVariant &packedFunc) } // The legacy protocol would only send a QTime, no QDateTime // so we assume it's sent today, which works in exactly the same cases as it did in the old implementation - QDateTime dateTime = QDateTime::currentDateTimeUtc(); + QDateTime dateTime = QDateTime::currentDateTime().toUTC(); dateTime.setTime(params[0].toTime()); handle(Protocol::HeartBeatReply(dateTime)); break; diff --git a/src/common/remotepeer.cpp b/src/common/remotepeer.cpp index f8deabfa..44033bd6 100644 --- a/src/common/remotepeer.cpp +++ b/src/common/remotepeer.cpp @@ -166,11 +166,7 @@ void RemotePeer::handle(const HeartBeat &heartBeat) void RemotePeer::handle(const HeartBeatReply &heartBeatReply) { _heartBeatCount = 0; -#if QT_VERSION < 0x040700 - emit lagUpdated(heartBeatReply.timestamp().time().msecsTo(QTime::currentTime()) / 2); -#else - emit lagUpdated(heartBeatReply.timestamp().msecsTo(QDateTime::currentDateTime()) / 2); -#endif + emit lagUpdated(heartBeatReply.timestamp().msecsTo(QDateTime::currentDateTime().toUTC()) / 2); } @@ -189,8 +185,6 @@ void RemotePeer::sendHeartBeat() emit lagUpdated(_lag); } - dispatch(HeartBeat(QDateTime::currentDateTime())); + dispatch(HeartBeat(QDateTime::currentDateTime().toUTC())); ++_heartBeatCount; } - -