Add ESP32 RTOS timesync

This commit is contained in:
Theo Arends 2021-01-04 16:10:22 +01:00
parent 0a882f53ba
commit aa943fc696
1 changed files with 9 additions and 0 deletions

View File

@ -400,6 +400,15 @@ void RtcSecond(void)
} else {
TasmotaGlobal.rules_flag.time_set = 1;
}
#ifdef ESP32
// Sync RTOS time to be used by SD Card time stamps
struct timeval tv;
tv.tv_sec = Rtc.local_time;
tv.tv_usec = 0;
settimeofday(&tv, nullptr);
#endif // ESP32
} else {
Rtc.utc_time++; // Increment every second
}