Skip to content

Commit 2ac90bb

Browse files
committed
Fixed sunrise/set UTC offset
1 parent 96422de commit 2ac90bb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

wled00/ntp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ void calculateSunriseAndSunset() {
420420
// there is a sunrise
421421
tim_0.tm_hour = minUTC / 60;
422422
tim_0.tm_min = minUTC % 60;
423-
sunrise = tz->toLocal(mktime(&tim_0) - utcOffsetSecs);
423+
sunrise = tz->toLocal(mktime(&tim_0) + utcOffsetSecs);
424424
DEBUG_PRINTF("Sunrise: %02d:%02d\n", hour(sunrise), minute(sunrise));
425425
} else {
426426
sunrise = 0;
@@ -431,7 +431,7 @@ void calculateSunriseAndSunset() {
431431
// there is a sunset
432432
tim_0.tm_hour = minUTC / 60;
433433
tim_0.tm_min = minUTC % 60;
434-
sunset = tz->toLocal(mktime(&tim_0) - utcOffsetSecs);
434+
sunset = tz->toLocal(mktime(&tim_0) + utcOffsetSecs);
435435
DEBUG_PRINTF("Sunset: %02d:%02d\n", hour(sunset), minute(sunset));
436436
} else {
437437
sunset = 0;

0 commit comments

Comments
 (0)