Add a InterpolatedTimeConverter to wrap time conversion
This gives us an interface that we can use in EventScheduler to query
the current time, and helpers to interpolate time from a list of points.
Change-Id: I44bd5f0f795604c63a29cb1e3f65815b790edb6a
diff --git a/aos/events/event_scheduler.h b/aos/events/event_scheduler.h
index c067048..959caea 100644
--- a/aos/events/event_scheduler.h
+++ b/aos/events/event_scheduler.h
@@ -43,6 +43,23 @@
std::ostream &operator<<(std::ostream &stream,
const aos::distributed_clock::time_point &now);
+// Interface to handle converting time on a node to and from the distributed
+// clock accurately.
+class TimeConverter {
+ public:
+ virtual ~TimeConverter() {}
+
+ // Converts a time to the distributed clock for scheduling and cross-node
+ // time measurement.
+ virtual distributed_clock::time_point ToDistributedClock(
+ size_t node_index, monotonic_clock::time_point time) = 0;
+
+ // Takes the distributed time and converts it to the monotonic clock for this
+ // node.
+ virtual monotonic_clock::time_point FromDistributedClock(
+ size_t node_index, distributed_clock::time_point time) = 0;
+};
+
class EventSchedulerScheduler;
class EventScheduler {