Send more information to each camera
This is what I'm thinking so Parker can write code for it.
Change-Id: I766747ed6c1bf5adc8d1c29e5d1896b8806b6eb9
diff --git a/aos/time/time.cc b/aos/time/time.cc
index f585192..06f4b12 100644
--- a/aos/time/time.cc
+++ b/aos/time/time.cc
@@ -185,5 +185,17 @@
#endif // __linux__
}
+#ifdef __linux__
+realtime_clock::time_point realtime_clock::now() noexcept {
+ struct timespec current_time;
+ if (clock_gettime(CLOCK_REALTIME, ¤t_time) != 0) {
+ PLOG(FATAL, "clock_gettime(%jd, %p) failed",
+ static_cast<uintmax_t>(CLOCK_REALTIME), ¤t_time);
+ }
+
+ return time_point(::std::chrono::seconds(current_time.tv_sec) +
+ ::std::chrono::nanoseconds(current_time.tv_nsec));
+}
+#endif // __linux__
} // namespace aos
diff --git a/aos/time/time.h b/aos/time/time.h
index 6f69aa7..136629c 100644
--- a/aos/time/time.h
+++ b/aos/time/time.h
@@ -24,7 +24,32 @@
typedef ::std::chrono::time_point<monotonic_clock> time_point;
static monotonic_clock::time_point now() noexcept;
- static constexpr bool is_steady = true;
+ // This clock is still subject to rate adjustments based on adjtime, so it is
+ // not steady.
+ static constexpr bool is_steady = false;
+
+ // Returns the epoch (0).
+ static constexpr monotonic_clock::time_point epoch() {
+ return time_point(zero());
+ }
+
+ static constexpr monotonic_clock::duration zero() { return duration(0); }
+
+ static constexpr time_point min_time{
+ time_point(duration(::std::numeric_limits<duration::rep>::min()))};
+};
+
+class realtime_clock {
+ public:
+ typedef ::std::chrono::nanoseconds::rep rep;
+ typedef ::std::chrono::nanoseconds::period period;
+ typedef ::std::chrono::nanoseconds duration;
+ typedef ::std::chrono::time_point<monotonic_clock> time_point;
+
+#ifdef __linux__
+ static monotonic_clock::time_point now() noexcept;
+#endif // __linux__
+ static constexpr bool is_steady = false;
// Returns the epoch (0).
static constexpr monotonic_clock::time_point epoch() {