Use remote sent times for calculating uptime in GetStatus
Do the same thing as when retrieving all statuses and use the monotonic
sent time of the status message as the "now" for calculating uptime.
This doesn't include the latency between the sending of the status
message and when aos_starter is run, but for typical use-cases that
shouldn't be an issue.
Change-Id: I73104b6a819d17817b4cbaf15378b91c852195bd
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/starter/starter_rpc_lib.cc b/aos/starter/starter_rpc_lib.cc
index a5bdbdd..e373e6b 100644
--- a/aos/starter/starter_rpc_lib.cc
+++ b/aos/starter/starter_rpc_lib.cc
@@ -258,7 +258,9 @@
return success;
}
-const std::optional<FlatbufferDetachedBuffer<aos::starter::ApplicationStatus>>
+const std::optional<
+ std::pair<aos::monotonic_clock::time_point,
+ FlatbufferDetachedBuffer<aos::starter::ApplicationStatus>>>
GetStatus(std::string_view name, const Configuration *config,
const aos::Node *node) {
ShmEventLoop event_loop(config);
@@ -271,7 +273,8 @@
const aos::starter::ApplicationStatus *status =
FindApplicationStatus(*status_fetcher, name);
if (status != nullptr) {
- return aos::CopyFlatBuffer(status);
+ return std::make_pair(status_fetcher.context().monotonic_remote_time,
+ aos::CopyFlatBuffer(status));
}
}
return std::nullopt;