From d3ce95c0cdcc6594b8e5e93fa02a36ff89b62a77 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Sun, 27 Jan 2013 22:35:33 +0100 Subject: [PATCH] Allow compilation against Qt < 4.7 again Looks like I recently introduced the use of some QDateTime stuff that appeared in Qt 4.7. Let's use the old way of calculating the lag then if built against older Qt... Oh, also this fixes that we would show double the lag. --- src/common/remoteconnection.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/remoteconnection.cpp b/src/common/remoteconnection.cpp index 1ce29d43..26a93350 100644 --- a/src/common/remoteconnection.cpp +++ b/src/common/remoteconnection.cpp @@ -166,7 +166,11 @@ void RemoteConnection::handle(const HeartBeat &heartBeat) void RemoteConnection::handle(const HeartBeatReply &heartBeatReply) { _heartBeatCount = 0; - emit lagUpdated(heartBeatReply.timestamp().msecsTo(QDateTime::currentDateTimeUtc())); +#if QT_VERSION < 0x040700 + emit lagUpdated(heartBeatReply.timestamp().time().msecsTo(QTime::currentTime()) / 2); +#else + emit lagUpdated(heartBeatReply.timestamp().msecsTo(QDateTime::currentDateTime()) / 2); +#endif } @@ -185,7 +189,7 @@ void RemoteConnection::sendHeartBeat() emit lagUpdated(_lag); } - dispatch(HeartBeat(QDateTime::currentDateTimeUtc())); + dispatch(HeartBeat(QDateTime::currentDateTime())); ++_heartBeatCount; } -- 2.20.1