From b5194c6be811927bd8fd8659cb3e7d5c5adfcb5e Mon Sep 17 00:00:00 2001 From: Sathya Laufer Date: Fri, 13 Apr 2018 17:10:05 +0200 Subject: [PATCH] Small changes --- timers/sun-position/SunTime.cpp | 2 +- timers/timer/MyNode.cpp | 8 ++++---- timers/timer/SunTime.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/timers/sun-position/SunTime.cpp b/timers/sun-position/SunTime.cpp index 03e19f8d..8e00f156 100644 --- a/timers/sun-position/SunTime.cpp +++ b/timers/sun-position/SunTime.cpp @@ -75,7 +75,7 @@ int64_t SunTime::getLocalTime(int64_t utcTime) const auto timePoint = std::chrono::system_clock::now(); t = std::chrono::system_clock::to_time_t(timePoint); } - std::tm localTime; + std::tm localTime {}; localtime_r(&t, &localTime); int64_t millisecondOffset = localTime.tm_gmtoff * 1000; if(utcTime > 0) return utcTime + millisecondOffset; diff --git a/timers/timer/MyNode.cpp b/timers/timer/MyNode.cpp index 5d25cf0b..4bada5fb 100644 --- a/timers/timer/MyNode.cpp +++ b/timers/timer/MyNode.cpp @@ -321,7 +321,7 @@ int64_t MyNode::getTime(int64_t currentTime, std::string time, std::string timeT if(timeVector.size() > 2) time += Flows::Math::getNumber64(timeVector.at(2)) * 1000; } } - std::tm timeStruct; + std::tm timeStruct {}; _sunTime.getTimeStruct(timeStruct); int64_t utcTime = _sunTime.getUtcTime(time); while(time < currentTime || !_days.at(timeStruct.tm_wday) || !_months.at(timeStruct.tm_mon)) @@ -403,7 +403,7 @@ std::string MyNode::getDateString(int64_t time) t = std::chrono::system_clock::to_time_t(timePoint); } char timeString[50]; - std::tm localTime; + std::tm localTime {}; localtime_r(&t, &localTime); strftime(&timeString[0], 50, &timeFormat[0], &localTime); std::ostringstream timeStream; @@ -466,7 +466,7 @@ void MyNode::timer() int32_t month = 0; { - std::tm tm; + std::tm tm {}; _sunTime.getTimeStruct(tm); day = tm.tm_wday; month = tm.tm_mon; @@ -532,7 +532,7 @@ void MyNode::timer() onTime = getTime(currentTime, _onTime, _onTimeType, _onOffset); offTime = getTime(currentTime, _offTime, _offTimeType, _offOffset); { - std::tm tm; + std::tm tm {}; _sunTime.getTimeStruct(tm); day = tm.tm_wday; month = tm.tm_mon; diff --git a/timers/timer/SunTime.cpp b/timers/timer/SunTime.cpp index f1c63ff3..ee904429 100644 --- a/timers/timer/SunTime.cpp +++ b/timers/timer/SunTime.cpp @@ -75,7 +75,7 @@ int64_t SunTime::getLocalTime(int64_t utcTime) const auto timePoint = std::chrono::system_clock::now(); t = std::chrono::system_clock::to_time_t(timePoint); } - std::tm localTime; + std::tm localTime {}; localtime_r(&t, &localTime); int64_t millisecondOffset = localTime.tm_gmtoff * 1000; if(utcTime > 0) return utcTime + millisecondOffset; @@ -90,7 +90,7 @@ int64_t SunTime::getUtcTime(int64_t localTime) } const auto timePoint = std::chrono::system_clock::now(); std::time_t t = std::chrono::system_clock::to_time_t(timePoint); - std::tm localTimeStruct; + std::tm localTimeStruct {}; localtime_r(&t, &localTimeStruct); int64_t millisecondOffset = localTimeStruct.tm_gmtoff * 1000; return localTime - millisecondOffset;