| 65 | } |
| 66 | |
| 67 | void 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 | |
| 93 | void updateTimeStr(struct tm timeInfo) { |
| 94 | if (bruceConfig.clock24hr) { |
no test coverage detected