Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
hfedcba committed Apr 13, 2018
2 parents 9e721ed + b5194c6 commit d23c191
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion timers/sun-position/SunTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions timers/timer/MyNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions timers/timer/SunTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit d23c191

Please sign in to comment.