Expose time to on_logged_period in the AOS logger
This lets us know what time the logger just finished writing so we can
use that info in any callbacks.
Change-Id: Ic94f6bc60a9270111d5d5e2327dbadd85e8e01f5
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/logging/logger_main.cc b/aos/events/logging/logger_main.cc
index afc166f..f99fe4c 100644
--- a/aos/events/logging/logger_main.cc
+++ b/aos/events/logging/logger_main.cc
@@ -79,12 +79,11 @@
aos::logger::Logger logger(&event_loop);
if (FLAGS_rotate_every != 0.0) {
- logger.set_on_logged_period([&] {
- const auto now = event_loop.monotonic_now();
- if (now > last_rotation_time +
- std::chrono::duration<double>(FLAGS_rotate_every)) {
+ logger.set_on_logged_period([&](aos::monotonic_clock::time_point t) {
+ if (t > last_rotation_time +
+ std::chrono::duration<double>(FLAGS_rotate_every)) {
logger.Rotate();
- last_rotation_time = now;
+ last_rotation_time = t;
}
});
}