diff options
Diffstat (limited to 'init/util.cpp')
-rw-r--r-- | init/util.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/init/util.cpp b/init/util.cpp index f59ba82e1..888a36652 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 @@ bool write_file(const char* path, const char* content) { 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) |