Add unit tests for duration metrics
As a side-effect, move utils::GetMonotonicTime() into the newly added
ClockInterface type.
BUG=None
TEST=Unit tests pass
Change-Id: I972a7e4ba37b63f96348fbeda901697b8ba2fc05
Reviewed-on: https://gerrit.chromium.org/gerrit/48814
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
diff --git a/real_system_state.h b/real_system_state.h
index 72a07ad..42d1509 100644
--- a/real_system_state.h
+++ b/real_system_state.h
@@ -7,6 +7,7 @@
#include <update_engine/system_state.h>
+#include <update_engine/clock.h>
#include <update_engine/connection_manager.h>
#include <update_engine/gpio_handler.h>
#include <update_engine/payload_state.h>
@@ -34,6 +35,10 @@
return device_policy_;
}
+ virtual inline ClockInterface* clock() {
+ return &clock_;
+ }
+
virtual inline ConnectionManager* connection_manager() {
return &connection_manager_;
}
@@ -73,6 +78,9 @@
bool Initialize(bool enable_gpio);
private:
+ // Interface for the clock.
+ Clock clock_;
+
// The latest device policy object from the policy provider.
const policy::DevicePolicy* device_policy_;