From 2e4de38eb868325fa0fb935188cf8b583698b638 Mon Sep 17 00:00:00 2001 From: xiaoxx970 Date: Wed, 5 Aug 2026 12:00:05 +0800 Subject: [PATCH] timed: set the clock from GPS in UTC, not local time (#38523) --- openpilot/system/timed.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpilot/system/timed.py b/openpilot/system/timed.py index 0413f645e3..6e5200d10e 100755 --- a/openpilot/system/timed.py +++ b/openpilot/system/timed.py @@ -12,7 +12,7 @@ from openpilot.common.gps import get_gps_location_service def set_time(new_time): - diff = datetime.datetime.now() - new_time + diff = datetime.datetime.now(datetime.UTC).replace(tzinfo=None) - new_time if abs(diff) < datetime.timedelta(seconds=10): cloudlog.debug(f"Time diff too small: {diff}") return @@ -47,7 +47,7 @@ def main() -> NoReturn: pm.send('clocks', msg) gps = sm[gps_location_service] - gps_time = datetime.datetime.fromtimestamp(gps.unixTimestampMillis / 1000.) + gps_time = datetime.datetime.fromtimestamp(gps.unixTimestampMillis / 1000., datetime.UTC).replace(tzinfo=None) if not sm.updated[gps_location_service] or (time.monotonic() - sm.logMonoTime[gps_location_service] / 1e9) > 2.0: continue if not gps.hasFix: