mirror of https://github.com/arendst/Tasmota.git
Fix RTOS time update (#10334)
This commit is contained in:
parent
f0c3226fc6
commit
2f63895599
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue