Browse Source

fix timezone

main
Hendrik Langer 7 years ago
parent
commit
ebd3aa0dd4
  1. 4
      src/main.cpp
  2. 3
      src/screen.cpp

4
src/main.cpp

@ -99,7 +99,7 @@ void setup() {
time_t now; time_t now;
struct tm timeinfo; struct tm timeinfo;
time(&now); time(&now);
setenv("TZ", "Europe/Berlin", 1); setenv("TZ", "CET-1CEST,M3.5.0/2,M10.5.0/3", 1);
tzset(); tzset();
localtime_r(&now, &timeinfo); localtime_r(&now, &timeinfo);
@ -269,8 +269,6 @@ void loop()
time_t now; time_t now;
struct tm timeinfo; struct tm timeinfo;
time(&now); time(&now);
setenv("TZ", "Europe/Berlin", 1);
tzset();
localtime_r(&now, &timeinfo); localtime_r(&now, &timeinfo);
strftime(timeStr, sizeof(timeStr), "%H:%M:%S", &timeinfo); strftime(timeStr, sizeof(timeStr), "%H:%M:%S", &timeinfo);

3
src/screen.cpp

@ -330,6 +330,9 @@ void AlarmClockScreen::previous() {
} }
uint8_t AlarmClockScreen::select() { uint8_t AlarmClockScreen::select() {
time_t now;
time(&now);
while(difftime(now, mktime(&alarmTime)) >= 0) alarmTime.tm_mday++;
setAlarmTime(alarmTime); setAlarmTime(alarmTime);
menuChange = eMainScreen; menuChange = eMainScreen;
} }

Loading…
Cancel
Save