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/clock.h b/clock.h
new file mode 100644
index 0000000..027bcff
--- /dev/null
+++ b/clock.h
@@ -0,0 +1,28 @@
+// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_CLOCK_H__
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_CLOCK_H__
+
+#include "update_engine/clock_interface.h"
+
+namespace chromeos_update_engine {
+
+// Implements a clock.
+class Clock : public ClockInterface {
+ public:
+ Clock() {}
+
+ virtual base::Time GetWallclockTime();
+
+ virtual base::Time GetMonotonicTime();
+
+ private:
+
+ DISALLOW_COPY_AND_ASSIGN(Clock);
+};
+
+} // namespace chromeos_update_engine
+
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_CLOCK_H__