diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-06-26 10:45:26 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-06-27 07:46:35 +0000 |
commit | a28678b83ac3a5a7530026027e2c16a23379168a (patch) | |
tree | aeb68e3cec1735987f91d2b4506c9b0b2ab7605b /src/plugins/sensors | |
parent | 6a8e8a64d3473c5ff890c022b738862a704516dc (diff) | |
download | qtsensors-a28678b83ac3a5a7530026027e2c16a23379168a.tar.gz |
Remove usages of deprecated APIs from QDateTime
- Replaced QTime by QElapsedTimer, because of the usage of
QTime::start() and QTime::elapsed() methods, which are deprecated.
- Replaced the deprecated QDateTime::toTime_t() with
QDateTime::toSecsSinceEpoch().
Task-number: QTBUG-76491
Change-Id: I625ce6bbc2718cd3c1b4905fecef9d75fdbab618
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'src/plugins/sensors')
7 files changed, 14 insertions, 14 deletions
diff --git a/src/plugins/sensors/simulator/simulatoraccelerometer.cpp b/src/plugins/sensors/simulator/simulatoraccelerometer.cpp index 481128f..280fc7e 100644 --- a/src/plugins/sensors/simulator/simulatoraccelerometer.cpp +++ b/src/plugins/sensors/simulator/simulatoraccelerometer.cpp @@ -54,9 +54,9 @@ void SimulatorAccelerometer::poll() QtMobility::QAccelerometerReadingData data = SensorsConnection::instance()->qtAccelerometerData; quint64 newTimestamp; if (!data.timestamp.isValid()) - newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000; + newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000; else - newTimestamp = data.timestamp.toTime_t(); + newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch()); if (m_reading.x() != data.x || m_reading.y() != data.y || m_reading.z() != data.z) { diff --git a/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp b/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp index 177684f..5d84b36 100644 --- a/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp +++ b/src/plugins/sensors/simulator/simulatorambientlightsensor.cpp @@ -76,9 +76,9 @@ void SimulatorAmbientLightSensor::poll() quint64 newTimestamp; if (!data.timestamp.isValid()) - newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000; + newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000; else - newTimestamp = data.timestamp.toTime_t(); + newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch()); if (m_reading.lightLevel() != convertedLightLevel) { m_reading.setTimestamp(newTimestamp); m_reading.setLightLevel(convertedLightLevel); diff --git a/src/plugins/sensors/simulator/simulatorcompass.cpp b/src/plugins/sensors/simulator/simulatorcompass.cpp index fc68c51..e9d0f1d 100644 --- a/src/plugins/sensors/simulator/simulatorcompass.cpp +++ b/src/plugins/sensors/simulator/simulatorcompass.cpp @@ -54,9 +54,9 @@ void SimulatorCompass::poll() QtMobility::QCompassReadingData data = SensorsConnection::instance()->qtCompassData; quint64 newTimestamp; if (!data.timestamp.isValid()) - newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000; + newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000; else - newTimestamp = data.timestamp.toTime_t(); + newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch()); if (m_reading.azimuth() != data.azimuth || m_reading.calibrationLevel() != data.calibrationLevel) { m_reading.setTimestamp(newTimestamp); diff --git a/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp b/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp index 4499128..d041a86 100644 --- a/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp +++ b/src/plugins/sensors/simulator/simulatorirproximitysensor.cpp @@ -54,9 +54,9 @@ void SimulatorIRProximitySensor::poll() QtMobility::QIRProximityReadingData data = SensorsConnection::instance()->qtIRProximityData; quint64 newTimestamp; if (!data.timestamp.isValid()) - newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000; + newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000; else - newTimestamp = data.timestamp.toTime_t(); + newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch()); if (m_reading.reflectance() != data.irProximity) { m_reading.setTimestamp(newTimestamp); m_reading.setReflectance(data.irProximity); diff --git a/src/plugins/sensors/simulator/simulatorlightsensor.cpp b/src/plugins/sensors/simulator/simulatorlightsensor.cpp index 40d9edb..bb4dd94 100644 --- a/src/plugins/sensors/simulator/simulatorlightsensor.cpp +++ b/src/plugins/sensors/simulator/simulatorlightsensor.cpp @@ -54,9 +54,9 @@ void SimulatorLightSensor::poll() QtMobility::QLightReadingData data = SensorsConnection::instance()->qtLightData; quint64 newTimestamp; if (!data.timestamp.isValid()) - newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000; + newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000; else - newTimestamp = data.timestamp.toTime_t(); + newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch()); if (m_reading.lux() != data.lux) { m_reading.setTimestamp(newTimestamp); m_reading.setLux(data.lux); diff --git a/src/plugins/sensors/simulator/simulatormagnetometer.cpp b/src/plugins/sensors/simulator/simulatormagnetometer.cpp index 64a3177..b54525a 100644 --- a/src/plugins/sensors/simulator/simulatormagnetometer.cpp +++ b/src/plugins/sensors/simulator/simulatormagnetometer.cpp @@ -54,9 +54,9 @@ void SimulatorMagnetometer::poll() QtMobility::QMagnetometerReadingData data = SensorsConnection::instance()->qtMagnetometerData; quint64 newTimestamp; if (!data.timestamp.isValid()) - newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000; + newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch()) / 1000; else - newTimestamp = data.timestamp.toTime_t(); + newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch()); if (m_reading.x() != data.x || m_reading.y() != data.y || m_reading.z() != data.z diff --git a/src/plugins/sensors/simulator/simulatorproximitysensor.cpp b/src/plugins/sensors/simulator/simulatorproximitysensor.cpp index b443095..6a28ce5 100644 --- a/src/plugins/sensors/simulator/simulatorproximitysensor.cpp +++ b/src/plugins/sensors/simulator/simulatorproximitysensor.cpp @@ -54,9 +54,9 @@ void SimulatorProximitySensor::poll() QtMobility::QProximityReadingData data = SensorsConnection::instance()->qtProximityData; quint64 newTimestamp; if (!data.timestamp.isValid()) - newTimestamp = QDateTime::currentMSecsSinceEpoch() / 1000; + newTimestamp = static_cast<quint64>(QDateTime::currentMSecsSinceEpoch() / 1000; else - newTimestamp = data.timestamp.toTime_t(); + newTimestamp = static_cast<quint64>(data.timestamp.toSecsSinceEpoch(); if (m_reading.close() != data.close) { m_reading.setTimestamp(newTimestamp); m_reading.setClose(data.close); |