diff --git a/selfdrive/ui/installer/installer.cc b/selfdrive/ui/installer/installer.cc index 17f6ba19ab..84486e61be 100644 --- a/selfdrive/ui/installer/installer.cc +++ b/selfdrive/ui/installer/installer.cc @@ -1,4 +1,3 @@ -#include #include #include @@ -11,6 +10,7 @@ #include #include +#include "common/util.h" #include "selfdrive/ui/installer/installer.h" #include "selfdrive/ui/qt/util.h" #include "selfdrive/ui/qt/qt_window.h" @@ -36,14 +36,6 @@ const QString CACHE_PATH = "/data/openpilot.cache"; extern const uint8_t str_continue[] asm("_binary_selfdrive_ui_installer_continue_openpilot_sh_start"); extern const uint8_t str_continue_end[] asm("_binary_selfdrive_ui_installer_continue_openpilot_sh_end"); -bool time_valid() { - time_t rawtime; - time(&rawtime); - - struct tm * sys_time = gmtime(&rawtime); - return (1900 + sys_time->tm_year) >= 2020; -} - void run(const char* cmd) { int err = std::system(cmd); assert(err == 0); @@ -103,7 +95,7 @@ void Installer::updateProgress(int percent) { void Installer::doInstall() { // wait for valid time - while (!time_valid()) { + while (!util::system_time_valid()) { usleep(500 * 1000); qDebug() << "Waiting for valid time"; }