From 0af28bba44c106f7e3aa766ec08ede91bcce75e4 Mon Sep 17 00:00:00 2001 From: iejMac <61431446+iejMac@users.noreply.github.com> Date: Mon, 26 Apr 2021 14:37:34 -0700 Subject: [PATCH] Replay: print timestamp every 5 seconds (#20752) * Replay: print timestamp every 5 seconds * include abs * rename last_print old-commit-hash: a759c12c1bce473788b9321da5a49a92b2f624fa --- selfdrive/ui/replay/Unlogger.cpp | 8 ++++++++ selfdrive/ui/replay/Unlogger.hpp | 1 + 2 files changed, 9 insertions(+) diff --git a/selfdrive/ui/replay/Unlogger.cpp b/selfdrive/ui/replay/Unlogger.cpp index d789e41322..5eaebdb529 100644 --- a/selfdrive/ui/replay/Unlogger.cpp +++ b/selfdrive/ui/replay/Unlogger.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -126,6 +127,13 @@ void Unlogger::process(SubMaster *sm) { tc = tm; if (it != socks.end()) { long etime = tm-t0; + + float timestamp = etime/1e9; + if(std::abs(timestamp-last_print) > 5.0){ + last_print = timestamp; + printf("at %f\n", last_print); + } + long rtime = timer.nsecsElapsed() - t0r; long us_behind = ((etime-rtime)*1e-3)+0.5; if (us_behind > 0) { diff --git a/selfdrive/ui/replay/Unlogger.hpp b/selfdrive/ui/replay/Unlogger.hpp index bfb0912879..9ba77c06e7 100644 --- a/selfdrive/ui/replay/Unlogger.hpp +++ b/selfdrive/ui/replay/Unlogger.hpp @@ -31,6 +31,7 @@ Q_OBJECT QMap socks; Context *ctx; uint64_t tc = 0; + float last_print = 0; uint64_t seek_request = 0; bool paused = false; bool loading_segment = false;