remove RTC time pull from panda (#202)

This commit is contained in:
Adeeb Shihadeh
2024-01-24 23:32:18 -08:00
committed by GitHub
parent ca2a5f202c
commit 5b9511af26
5 changed files with 0 additions and 64 deletions
-42
View File
@@ -1,42 +0,0 @@
#!/usr/bin/env python3
import datetime
import os
import sys
from pathlib import Path
here = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, here)
from panda import Panda
# Systemd pushes the system time to the systemd build time if no time is set
MIN_DATE = datetime.datetime.fromtimestamp(Path("/lib/systemd/systemd").stat().st_mtime)
MIN_DATE += datetime.timedelta(days=1)
if __name__ == "__main__":
sys_time = datetime.datetime.today()
print(f"System time: {sys_time}")
if sys_time > MIN_DATE:
print("System time valid")
exit()
ps = Panda.list()
if len(ps) == 0:
print("Failed to set time, no pandas found")
exit()
for s in ps:
with Panda(serial=s) as p:
if not p.is_internal():
continue
# Set system time from panda RTC time
panda_time = p.get_datetime()
print(f"panda time: {panda_time}")
if panda_time > MIN_DATE:
print(f"adjusting time from '{sys_time}' to '{panda_time}'")
os.system(f"TZ=UTC date -s '{panda_time}'")
else:
print("panda time invalid")
break
else:
print("No internal pandas found")
-4
View File
@@ -51,10 +51,6 @@ def test_color_calibration():
def test_python_shims():
subprocess.check_call("cd /data/openpilot && scons -h", shell=True, stdout=subprocess.DEVNULL)
def test_set_time():
# TODO: ensure time is set from panda RTC
pass
def test_dmesg():
# TODO: ensure no new errors in dmesg. would catch things like the brightness setting bug
pass