Revert "bootstat: Refactor init/utils/boot_clock into base/chrono_utils."
This reverts commit 7c92e484503f239000ef97ef5b067907fbeaa4a6.
Mac sdk still broken (despite testing locally).
Change-Id: I7d9206e15997cd0efe081bd3fa17d53d2b20ec32
diff --git a/init/util.cpp b/init/util.cpp
index f59ba82..888a366 100644
--- a/init/util.cpp
+++ b/init/util.cpp
@@ -51,8 +51,6 @@
#include "property_service.h"
#include "util.h"
-using android::base::boot_clock;
-
static unsigned int do_decode_uid(const char *s)
{
unsigned int v;
@@ -201,16 +199,11 @@
return success;
}
-Timer::Timer() : start_(boot_clock::now()) {
-}
-
-double Timer::duration_s() const {
- typedef std::chrono::duration<double> double_duration;
- return std::chrono::duration_cast<double_duration>(boot_clock::now() - start_).count();
-}
-
-int64_t Timer::duration_ms() const {
- return std::chrono::duration_cast<std::chrono::milliseconds>(boot_clock::now() - start_).count();
+boot_clock::time_point boot_clock::now() {
+ timespec ts;
+ clock_gettime(CLOCK_BOOTTIME, &ts);
+ return boot_clock::time_point(std::chrono::seconds(ts.tv_sec) +
+ std::chrono::nanoseconds(ts.tv_nsec));
}
int mkdir_recursive(const char *pathname, mode_t mode)