timed: publish clocks periodically (#31434)

* timed: publish clocks periodically

* simplify

* Apply suggestions from code review
pull/31440/head
Adeeb Shihadeh 1 year ago committed by GitHub
parent d6762c3035
commit c5739651a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      cereal
  2. 5
      system/timed.py

@ -1 +1 @@
Subproject commit 9b573c2be34b638ff462648308d3c7075d0ff174
Subproject commit e842020c1c7a2c43fda17f4075307ae8abb9bc3a

@ -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

Loading…
Cancel
Save