From aa943fc696802ecb5946f78f0f5ecce0641dd365 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 4 Jan 2021 16:10:22 +0100 Subject: [PATCH] Add ESP32 RTOS timesync --- tasmota/support_rtc.ino | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tasmota/support_rtc.ino b/tasmota/support_rtc.ino index fc8a14042..9884b337f 100644 --- a/tasmota/support_rtc.ino +++ b/tasmota/support_rtc.ino @@ -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 }