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

pull/28465/head
Adeeb Shihadeh 2 years ago committed by GitHub
parent 6bb61780ab
commit 6bf1f81859
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      selfdrive/boardd/boardd.cc

@ -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.");
}
}
}

Loading…
Cancel
Save