diff options
author | James Hawkins <jhawkins@google.com> | 2017-02-14 19:20:20 +0000 |
---|---|---|
committer | James Hawkins <jhawkins@google.com> | 2017-02-14 19:20:20 +0000 |
commit | c8ac0677734270f0b12d85ecf23b1de49054890c (patch) | |
tree | d28d14e07cfa47388dea9ccded51df626c430edc /init/util.cpp | |
parent | 7c92e484503f239000ef97ef5b067907fbeaa4a6 (diff) | |
download | system_core-c8ac0677734270f0b12d85ecf23b1de49054890c.tar.gz system_core-c8ac0677734270f0b12d85ecf23b1de49054890c.tar.bz2 system_core-c8ac0677734270f0b12d85ecf23b1de49054890c.zip |
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
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) |