Account for socketcan providing realtime timestamps
We are getting realtime timestamps back, but were treating them as
monotonic times. Fix that.
Change-Id: Ib92ced05870dcfa7a476ce2509b28eb307bda5ac
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/frc971/can_logger/can_logger.cc b/frc971/can_logger/can_logger.cc
index cfc3dd8..7d33464 100644
--- a/frc971/can_logger/can_logger.cc
+++ b/frc971/can_logger/can_logger.cc
@@ -75,8 +75,8 @@
can_frame_builder.add_can_id(frame.can_id);
can_frame_builder.add_flags(frame.flags);
can_frame_builder.add_data(frame_data);
- can_frame_builder.add_monotonic_timestamp_ns(
- static_cast<std::chrono::nanoseconds>(
+ can_frame_builder.add_realtime_timestamp_ns(
+ std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::seconds(tv.tv_sec) +
std::chrono::microseconds(tv.tv_usec))
.count());