From ebd3aa0dd48d3b4b0f9b2bfe9b8e3e79a1e5f3f5 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Wed, 7 Feb 2018 15:31:45 +0100 Subject: [PATCH] fix timezone --- src/main.cpp | 4 +--- src/screen.cpp | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index d17c70c..e6ae2ef 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -99,7 +99,7 @@ void setup() { time_t now; struct tm timeinfo; time(&now); - setenv("TZ", "Europe/Berlin", 1); + setenv("TZ", "CET-1CEST,M3.5.0/2,M10.5.0/3", 1); tzset(); localtime_r(&now, &timeinfo); @@ -269,8 +269,6 @@ void loop() time_t now; struct tm timeinfo; time(&now); - setenv("TZ", "Europe/Berlin", 1); - tzset(); localtime_r(&now, &timeinfo); strftime(timeStr, sizeof(timeStr), "%H:%M:%S", &timeinfo); diff --git a/src/screen.cpp b/src/screen.cpp index 44c9821..23a8121 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -330,6 +330,9 @@ void AlarmClockScreen::previous() { } uint8_t AlarmClockScreen::select() { + time_t now; + time(&now); + while(difftime(now, mktime(&alarmTime)) >= 0) alarmTime.tm_mday++; setAlarmTime(alarmTime); menuChange = eMainScreen; }