Stricter check on date for RTC time sync (#2582)

* More strict check on time

* Also update thermald
pull/2583/head
Willem Melching 2020-11-20 11:47:39 +01:00 committed by GitHub
parent 7378bc4284
commit ff65dc1401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -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() {

View File

@ -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