boardd: log system and RTC time before sync (#28461)

old-commit-hash: 6bf1f81859bc03456a9a49245b434dbd35cc4442
This commit is contained in:
Adeeb Shihadeh
2023-06-08 19:50:49 -07:00
committed by GitHub
parent aef0c54a26
commit 380be7b25c
+3 -2
View File
@@ -94,11 +94,12 @@ void sync_time(Panda *panda, SyncTimeDir dir) {
}
}
} else if (dir == SyncTimeDir::FROM_PANDA) {
LOGW("System time: %s, RTC time: %s", get_time_str(sys_time).c_str(), get_time_str(rtc_time).c_str());
if (!util::time_valid(sys_time) && util::time_valid(rtc_time)) {
const struct timeval tv = {mktime(&rtc_time), 0};
settimeofday(&tv, 0);
LOGE("System time wrong, setting from RTC. System: %s RTC: %s",
get_time_str(sys_time).c_str(), get_time_str(rtc_time).c_str());
LOGE("System time wrong, setting from RTC.");
}
}
}