Fix lag display
authorManuel Nickschas <sputnick@quassel-irc.org>
Sun, 7 Apr 2013 22:22:18 +0000 (00:22 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 7 Apr 2013 22:22:18 +0000 (00:22 +0200)
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.

src/common/protocols/legacy/legacypeer.cpp
src/common/remotepeer.cpp

index d000047..0f9c61e 100644 (file)
@@ -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
             }
             // 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;
             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
             }
             // 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;
             dateTime.setTime(params[0].toTime());
             handle(Protocol::HeartBeatReply(dateTime));
             break;
index f8deabf..44033bd 100644 (file)
@@ -166,11 +166,7 @@ void RemotePeer::handle(const HeartBeat &heartBeat)
 void RemotePeer::handle(const HeartBeatReply &heartBeatReply)
 {
     _heartBeatCount = 0;
 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);
     }
 
         emit lagUpdated(_lag);
     }
 
-    dispatch(HeartBeat(QDateTime::currentDateTime()));
+    dispatch(HeartBeat(QDateTime::currentDateTime().toUTC()));
     ++_heartBeatCount;
 }
     ++_heartBeatCount;
 }
-
-