From c5739651a241788f9c84ebf705325de57aabfc39 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Tue, 13 Feb 2024 14:22:46 -0800 Subject: [PATCH] timed: publish clocks periodically (#31434) * timed: publish clocks periodically * simplify * Apply suggestions from code review --- cereal | 2 +- system/timed.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cereal b/cereal index 9b573c2be3..e842020c1c 160000 --- a/cereal +++ b/cereal @@ -1 +1 @@ -Subproject commit 9b573c2be34b638ff462648308d3c7075d0ff174 +Subproject commit e842020c1c7a2c43fda17f4075307ae8abb9bc3a diff --git a/system/timed.py b/system/timed.py index 21fb47b680..39acb2ba12 100755 --- a/system/timed.py +++ b/system/timed.py @@ -65,10 +65,15 @@ def main() -> NoReturn: cloudlog.debug("Restoring timezone from param") set_timezone(tz) + pm = messaging.PubMaster(['clocks']) sm = messaging.SubMaster(['liveLocationKalman']) while True: sm.update(1000) + msg = messaging.new_message('clocks', valid=True) + msg.clocks.wallTimeNanos = time.time_ns() + pm.send('clocks', msg) + llk = sm['liveLocationKalman'] if not llk.gpsOK or (time.monotonic() - sm.logMonoTime['liveLocationKalman']/1e9) > 0.2: continue