bootstat: Refactor init/utils/boot_clock into base/chrono_utils.
Use this for bootstat and init. This replaces the custom uptime parser in
bootstat.
This is a reland of aosp/332854 with a fix for Darwin.
Bug: 34352037
Test: chrono_utils_test
Change-Id: Ib2567d8df0e460ab59753ac1c053dd7f9f1008a7
diff --git a/init/init.cpp b/init/init.cpp
index 43f601f..4af0656 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -40,6 +40,7 @@
#include <selinux/label.h>
#include <selinux/android.h>
+#include <android-base/chrono_utils.h>
#include <android-base/file.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
@@ -68,6 +69,7 @@
#include "util.h"
#include "watchdogd.h"
+using android::base::boot_clock;
using android::base::StringPrintf;
struct selabel_handle *sehandle;
@@ -750,7 +752,7 @@
return watchdogd_main(argc, argv);
}
- boot_clock::time_point start_time = boot_clock::now();
+ boot_clock::time_point start_time = android::base::boot_clock::now();
// Clear the umask.
umask(0);