From d6990d3e9171dd9363391f34b79a257cc4e9c7b7 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Thu, 16 May 2019 14:59:12 +0200 Subject: [PATCH] Compile with older qt versions --- openweathermap/devicepluginopenweathermap.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openweathermap/devicepluginopenweathermap.cpp b/openweathermap/devicepluginopenweathermap.cpp index a39690d8..3f36cbd8 100644 --- a/openweathermap/devicepluginopenweathermap.cpp +++ b/openweathermap/devicepluginopenweathermap.cpp @@ -383,14 +383,14 @@ void DevicePluginOpenweathermap::processWeatherData(const QByteArray &data, Devi } if (dataMap.contains("sys")) { - uint sunrise = dataMap.value("sys").toMap().value("sunrise").toUInt(); - uint sunset = dataMap.value("sys").toMap().value("sunset").toUInt(); + qint64 sunrise = dataMap.value("sys").toMap().value("sunrise").toLongLong(); + qint64 sunset = dataMap.value("sys").toMap().value("sunset").toLongLong(); device->setStateValue(openweathermapSunriseTimeStateTypeId, sunrise); device->setStateValue(openweathermapSunsetTimeStateTypeId, sunset); QTimeZone tz = QTimeZone(QTimeZone::systemTimeZoneId()); - QDateTime up = QDateTime::fromSecsSinceEpoch(sunrise); - QDateTime down = QDateTime::fromSecsSinceEpoch(sunset); + QDateTime up = QDateTime::fromMSecsSinceEpoch(sunrise * 1000); + QDateTime down = QDateTime::fromMSecsSinceEpoch(sunset * 1000); QDateTime now = QDateTime::currentDateTime().toTimeZone(tz); device->setStateValue(openweathermapDaylightStateTypeId, up < now && down > now); }