|
|
@ -94,11 +94,12 @@ void sync_time(Panda *panda, SyncTimeDir dir) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (dir == SyncTimeDir::FROM_PANDA) { |
|
|
|
} 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)) { |
|
|
|
if (!util::time_valid(sys_time) && util::time_valid(rtc_time)) { |
|
|
|
const struct timeval tv = {mktime(&rtc_time), 0}; |
|
|
|
const struct timeval tv = {mktime(&rtc_time), 0}; |
|
|
|
settimeofday(&tv, 0); |
|
|
|
settimeofday(&tv, 0); |
|
|
|
LOGE("System time wrong, setting from RTC. System: %s RTC: %s", |
|
|
|
LOGE("System time wrong, setting from RTC."); |
|
|
|
get_time_str(sys_time).c_str(), get_time_str(rtc_time).c_str()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|