thermald: common min date (#28457)

* thermald: common min date

* add to release files
old-commit-hash: d96361970b
beeps
Adeeb Shihadeh 2 years ago committed by GitHub
parent eddc84d104
commit 4ab84b5dc1
  1. 3
      common/time.py
  2. 2
      common/util.cc
  3. 1
      release/files_common
  4. 2
      selfdrive/boardd/set_time.py
  5. 3
      selfdrive/thermald/thermald.py

@ -0,0 +1,3 @@
import datetime
MIN_DATE = datetime.datetime(year=2023, month=6, day=1)

@ -260,7 +260,7 @@ struct tm get_time() {
bool time_valid(struct tm sys_time) { bool time_valid(struct tm sys_time) {
int year = 1900 + sys_time.tm_year; int year = 1900 + sys_time.tm_year;
int month = 1 + sys_time.tm_mon; int month = 1 + sys_time.tm_mon;
return (year > 2021) || (year == 2021 && month >= 6); return (year > 2023) || (year == 2023 && month >= 6);
} }
} // namespace util } // namespace util

@ -35,6 +35,7 @@ common/filter_simple.py
common/stat_live.py common/stat_live.py
common/spinner.py common/spinner.py
common/text_window.py common/text_window.py
common/time.py
common/kalman/.gitignore common/kalman/.gitignore
common/kalman/* common/kalman/*

@ -3,7 +3,7 @@ import os
import datetime import datetime
from panda import Panda from panda import Panda
MIN_DATE = datetime.datetime(year=2023, month=4, day=1) from common.time import MIN_DATE
def set_time(logger): def set_time(logger):
sys_time = datetime.datetime.today() sys_time = datetime.datetime.today()

@ -13,6 +13,7 @@ import psutil
import cereal.messaging as messaging import cereal.messaging as messaging
from cereal import log from cereal import log
from common.dict_helpers import strip_deprecated_keys from common.dict_helpers import strip_deprecated_keys
from common.time import MIN_DATE
from common.filter_simple import FirstOrderFilter from common.filter_simple import FirstOrderFilter
from common.params import Params from common.params import Params
from common.realtime import DT_TRML, sec_since_boot from common.realtime import DT_TRML, sec_since_boot
@ -272,7 +273,7 @@ def thermald_thread(end_event, hw_queue):
# Ensure date/time are valid # Ensure date/time are valid
now = datetime.datetime.utcnow() now = datetime.datetime.utcnow()
startup_conditions["time_valid"] = (now.year > 2020) or (now.year == 2020 and now.month >= 10) startup_conditions["time_valid"] = now > MIN_DATE
set_offroad_alert_if_changed("Offroad_InvalidTime", (not startup_conditions["time_valid"])) set_offroad_alert_if_changed("Offroad_InvalidTime", (not startup_conditions["time_valid"]))
startup_conditions["up_to_date"] = params.get("Offroad_ConnectivityNeeded") is None or params.get_bool("DisableUpdates") or params.get_bool("SnoozeUpdate") startup_conditions["up_to_date"] = params.get("Offroad_ConnectivityNeeded") is None or params.get_bool("DisableUpdates") or params.get_bool("SnoozeUpdate")

Loading…
Cancel
Save