|
|
|
@ -62,12 +62,6 @@ std::atomic<bool> pigeon_active(false); |
|
|
|
|
|
|
|
|
|
ExitHandler do_exit; |
|
|
|
|
|
|
|
|
|
std::string get_time_str(const struct tm &time) { |
|
|
|
|
char s[30] = {'\0'}; |
|
|
|
|
std::strftime(s, std::size(s), "%Y-%m-%d %H:%M:%S", &time); |
|
|
|
|
return s; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool check_all_connected(const std::vector<Panda *> &pandas) { |
|
|
|
|
for (const auto& panda : pandas) { |
|
|
|
|
if (!panda->connected) { |
|
|
|
@ -83,6 +77,12 @@ enum class SyncTimeDir { TO_PANDA, FROM_PANDA }; |
|
|
|
|
void sync_time(Panda *panda, SyncTimeDir dir) { |
|
|
|
|
if (!panda->has_rtc) return; |
|
|
|
|
|
|
|
|
|
auto get_time_str = [](const struct tm &time) { |
|
|
|
|
char s[30] = {'\0'}; |
|
|
|
|
std::strftime(s, std::size(s), "%Y-%m-%d %H:%M:%S", &time); |
|
|
|
|
return std::string(s); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
setenv("TZ", "UTC", 1); |
|
|
|
|
struct tm sys_time = util::get_time(); |
|
|
|
|
struct tm rtc_time = panda->get_rtc(); |
|
|
|
|