Skip to content

Commit 9068603

Browse files
committed
Set TZ in watchy so everyone can have a local time
1 parent 0e2a0ae commit 9068603

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Screens/TimeScreen.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ void rightJustify(const char *txt, uint16_t &yPos) {
2929
}
3030

3131
void TimeScreen::show() {
32-
setenv("TZ", Watchy_GetLocation::currentLocation.timezone, 1);
33-
tzset();
3432
tm t;
3533
time_t tt = now();
3634
localtime_r(&tt, &t);

src/Watchy.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "Watchy.h"
22

33
#include "Screen.h"
4-
#include "Screens/SetLocationScreen.h" // bad hack
4+
#include "GetLocation.h" // bad dependency
55

66
using namespace Watchy;
77

@@ -45,6 +45,8 @@ void Watchy::init(String datetime) {
4545
// sync ESP32 clocks to RTC
4646
tmElements_t currentTime;
4747
if (Watchy::RTC.read(currentTime) == 0) {
48+
setenv("TZ", Watchy_GetLocation::currentLocation.timezone, 1);
49+
tzset();
4850
time_t t = makeTime(currentTime);
4951
setTime(t);
5052
timeval tv = {t, 0};

0 commit comments

Comments
 (0)