timed: publish clocks periodically (#31434)

* timed: publish clocks periodically

* simplify

* Apply suggestions from code review
old-commit-hash: c5739651a241788f9c84ebf705325de57aabfc39
This commit is contained in:
Adeeb Shihadeh
2024-02-13 14:22:46 -08:00
committed by GitHub
parent 8b5f1235f4
commit 9fab120968
2 changed files with 6 additions and 1 deletions
+1 -1
Submodule cereal updated: 9b573c2be3...e842020c1c
+5
View File
@@ -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