diff options
author | hjk <hjk@qt.io> | 2019-07-01 14:36:15 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-07-01 15:42:31 +0200 |
commit | 2c24a9ec62741cbfc6a9fe0f5c05ff370a9e9414 (patch) | |
tree | 9472564f139f7892e32dbe6202aee220fe580320 | |
parent | 1cd05c3cb307b28bfae47e0d63bd37b6c5718cbe (diff) |
Avoid deprecated use of QTime
Change-Id: If95c4f918b83057001bc43e01e9450ba1d08b475
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
-rw-r--r-- | tests/auto/qmqttlastwillproperties/tst_qmqttlastwillproperties.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/auto/qmqttlastwillproperties/tst_qmqttlastwillproperties.cpp b/tests/auto/qmqttlastwillproperties/tst_qmqttlastwillproperties.cpp index 77a46b5..1b93866 100644 --- a/tests/auto/qmqttlastwillproperties/tst_qmqttlastwillproperties.cpp +++ b/tests/auto/qmqttlastwillproperties/tst_qmqttlastwillproperties.cpp @@ -28,6 +28,7 @@ #include "broker_connection.h" +#include <QtCore/QElapsedTimer> #include <QtCore/QString> #include <QtTest/QtTest> #include <QtMqtt/QMqttClient> @@ -176,7 +177,7 @@ void tst_QMqttLastWillProperties::willDelay() recipient.connectToHost(); QTRY_VERIFY2(recipient.state() == QMqttClient::Connected, "Could not connect to broker"); - QTime delayTime; + QElapsedTimer delayTimer; bool receivedWill = false; auto sub = recipient.subscribe(wTopic, 1); connect(sub, &QMqttSubscription::messageReceived, this, [wMessage, &receivedWill](QMqttMessage m) { @@ -187,13 +188,12 @@ void tst_QMqttLastWillProperties::willDelay() auto transport = client.transport(); transport->close(); // closing transport does not send DISCONNECT - delayTime = QTime::currentTime(); - delayTime.start(); + delayTimer.start(); const int minimalWait = qMin(delay, expiry) * 1000; const int maximumWait = 2 * (minimalWait == 0 ? 1000 : minimalWait); QTRY_VERIFY2_WITH_TIMEOUT(receivedWill, "Did not receive a will message", delay * 1000 * 3); - const int elapsed = delayTime.elapsed(); + const int elapsed = delayTimer.elapsed(); QVERIFY(elapsed > minimalWait); QVERIFY(elapsed < maximumWait); } |