Save remote timestamps in timestamp log file headers

We have the earliest time a message made it across the network in each
log file.  Previously, this was only done for the main data files, so
we'd only get timestamps when our message_bridge_client is connected to
the remote.  We see some logs where we never connect, so we never get
those timestamps.  There is still enough information in the log files to
sort if we fix that.

There are 3 parts to this.
  1) Clarify that we really mean source node for the timestamps, not
     logger node.
  2) Put the timestamps in the log file header
  3) Update the sorting code.

This exposes a bug in the log reader where it can't handle a node
without a start time.  A follow-up commit will fix that, but that can
happen while this is being reviewed.

Change-Id: Iff898dc30ec0fb54d670ea21412d8ad35ab80f4c
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/events/logging/log_writer.cc b/aos/events/logging/log_writer.cc
index f379ca4..8eaeb73 100644
--- a/aos/events/logging/log_writer.cc
+++ b/aos/events/logging/log_writer.cc
@@ -695,6 +695,20 @@
         const auto end = event_loop_->monotonic_now();
         RecordCreateMessageTime(start, end, &f);
 
+        // Timestamps tell us information about what happened too!
+        // Capture any reboots so UpdateRemote is properly recorded.
+        f.contents_writer->UpdateBoot(UUID::FromVector(msg->boot_uuid()));
+
+        // Start with recording info about the data flowing from our node to the
+        // remote.
+        f.contents_writer->UpdateRemote(
+            node_index_, event_loop_->boot_uuid(),
+            monotonic_clock::time_point(
+                chrono::nanoseconds(msg->monotonic_remote_time())),
+            monotonic_clock::time_point(
+                chrono::nanoseconds(msg->monotonic_sent_time())),
+            f.reliable_forwarding);
+
         f.contents_writer->QueueMessage(
             &fbb, UUID::FromVector(msg->boot_uuid()), end);
       }