Skip to content

Commit 2421d5a

Browse files
Driver55marcelstoer
authored andcommitted
Use gmtime instead of localtime (#127)
Fixes #125 According to the openweathermap.org API documentation, the "ObservationTime" parameter refers to UTC time and therefore should not be converted to localtime.
1 parent ce22ed6 commit 2421d5a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/OpenWeatherMapForecast.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void OpenWeatherMapForecast::value(String value) {
104104
if (allowedHoursCount > 0) {
105105
time_t time = data[currentForecast].observationTime;
106106
struct tm* timeInfo;
107-
timeInfo = localtime(&time);
107+
timeInfo = gmtime(&time);
108108
uint8_t currentHour = timeInfo->tm_hour;
109109
for (uint8_t i = 0; i < allowedHoursCount; i++) {
110110
if (currentHour == allowedHours[i]) {

0 commit comments

Comments
 (0)