Support replaying the realtime clock from logs

This adds the concept of the realtime offset to the event scheduler.

Side note: the event scheduler is going to have to get significantly
more complicated when multi-node log files show up.

Change-Id: Ia6f891c77b8c3badcea930cdfa0e236acbff7801
diff --git a/aos/events/event_scheduler.h b/aos/events/event_scheduler.h
index 2fcf90b..432f4ad 100644
--- a/aos/events/event_scheduler.h
+++ b/aos/events/event_scheduler.h
@@ -45,15 +45,23 @@
   bool is_running() const { return is_running_; }
 
   monotonic_clock::time_point monotonic_now() const { return now_; }
+
   realtime_clock::time_point realtime_now() const {
-    // TODO(austin): Make this all configurable...
-    return realtime_clock::epoch() + now_.time_since_epoch() +
-           std::chrono::seconds(1000000);
+    return realtime_clock::time_point(monotonic_now().time_since_epoch() +
+                                      realtime_offset_);
+  }
+
+  // Sets realtime clock to realtime_now for a given monotonic clock.
+  void SetRealtimeOffset(monotonic_clock::time_point monotonic_now,
+                         realtime_clock::time_point realtime_now) {
+    realtime_offset_ =
+        realtime_now.time_since_epoch() - monotonic_now.time_since_epoch();
   }
 
  private:
   // Current execution time.
   monotonic_clock::time_point now_ = monotonic_clock::epoch();
+  std::chrono::nanoseconds realtime_offset_ = std::chrono::seconds(0);
 
   std::vector<std::function<void()>> on_run_;