From 67249ef8aa3da9b59ea1ebaf11bdaad62960c43d Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Fri, 20 Nov 2020 11:47:39 +0100 Subject: [PATCH] Stricter check on date for RTC time sync (#2582) * More strict check on time * Also update thermald old-commit-hash: ff65dc1401681ca71f6449c5e059eb7a2fb2256c --- selfdrive/boardd/boardd.cc | 4 +++- selfdrive/thermald/thermald.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/selfdrive/boardd/boardd.cc b/selfdrive/boardd/boardd.cc index d851f7a449..1033c08256 100644 --- a/selfdrive/boardd/boardd.cc +++ b/selfdrive/boardd/boardd.cc @@ -56,7 +56,9 @@ struct tm get_time(){ } bool time_valid(struct tm sys_time){ - return 1900 + sys_time.tm_year >= 2019; + int year = 1900 + sys_time.tm_year; + int month = 1 + sys_time.tm_mon; + return (year > 2020) || (year == 2020 && month >= 10); } void safety_setter_thread() { diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index e902a9eb74..df606f8b0b 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -309,7 +309,7 @@ def thermald_thread(): now = datetime.datetime.utcnow() # show invalid date/time alert - startup_conditions["time_valid"] = now.year >= 2019 + startup_conditions["time_valid"] = (now.year > 2020) or (now.year == 2020 and now.month >= 10) set_offroad_alert_if_changed("Offroad_InvalidTime", (not startup_conditions["time_valid"])) # Show update prompt