MCPcopy Create free account
hub / github.com/BruceDevices/firmware / updateClockTimezone

Function updateClockTimezone

src/core/utils.cpp:67–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void updateClockTimezone() {
68 timeClient.begin();
69 timeClient.update();
70
71 timeClient.setTimeOffset(bruceConfig.tmz * 3600);
72
73 localTime = timeClient.getEpochTime() + (bruceConfig.dst ? 3600 : 0);
74
75#if defined(HAS_RTC)
76 struct tm *timeinfo = localtime(&localTime);
77 RTC_TimeTypeDef TimeStruct;
78 TimeStruct.Hours = timeinfo->tm_hour;
79 TimeStruct.Minutes = timeinfo->tm_min;
80 TimeStruct.Seconds = timeinfo->tm_sec;
81 _rtc.SetTime(&TimeStruct);
82 updateTimeStr(_rtc.getTimeStruct());
83#else
84 rtc.setTime(localTime);
85 updateTimeStr(rtc.getTimeStruct());
86 clock_set = true;
87#endif
88 // Update Internal clock to system time
89 struct timeval tv = {.tv_sec = localTime};
90 settimeofday(&tv, nullptr);
91}
92
93void updateTimeStr(struct tm timeInfo) {
94 if (bruceConfig.clock24hr) {

Callers 2

setClockFunction · 0.85
updateTimezoneTaskFunction · 0.85

Calls 5

updateTimeStrFunction · 0.85
beginMethod · 0.45
updateMethod · 0.45
SetTimeMethod · 0.45
getTimeStructMethod · 0.45

Tested by

no test coverage detected