Fix RTOS time update (#10334)

This commit is contained in:
Theo Arends 2021-01-05 10:37:05 +01:00
parent f0c3226fc6
commit 2f63895599
1 changed files with 11 additions and 9 deletions

View File

@ -400,15 +400,6 @@ 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
}
@ -463,6 +454,17 @@ void RtcSecond(void)
Rtc.midnight = Rtc.local_time;
Rtc.midnight_now = true;
}
#ifdef ESP32
if (mutex) { // Time is just synced and is valid
// 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
}
RtcTime.year += 1970;