summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Gao2017-05-01 16:56:28 -0500
committerJosh Gao2017-05-01 16:56:28 -0500
commit0b35b18f88ebeb8f3cb2291c239dd2cb3732d0cc (patch)
tree9cb22353e91afbd4bbdb0a0a1be99c032c55d3cd /base/chrono_utils.cpp
parentae29339ca138648eeaee68f801feb02d85ee2abf (diff)
downloadplatform-system-core-0b35b18f88ebeb8f3cb2291c239dd2cb3732d0cc.tar.gz
platform-system-core-0b35b18f88ebeb8f3cb2291c239dd2cb3732d0cc.tar.xz
platform-system-core-0b35b18f88ebeb8f3cb2291c239dd2cb3732d0cc.zip
Revert "base: make boot_clock work on host linux, hide it on non-linux."
This reverts commit ae29339ca138648eeaee68f801feb02d85ee2abf, which broke the darwin build. Change-Id: Ib33e2dab197532f04944cb12151002e9219b1bb5
Diffstat (limited to 'base/chrono_utils.cpp')
-rw-r--r--base/chrono_utils.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/base/chrono_utils.cpp b/base/chrono_utils.cpp
index d73b551b5..5eedf3bce 100644
--- a/base/chrono_utils.cpp
+++ b/base/chrono_utils.cpp
@@ -21,14 +21,17 @@
21namespace android { 21namespace android {
22namespace base { 22namespace base {
23 23
24#if defined(__linux__)
25boot_clock::time_point boot_clock::now() { 24boot_clock::time_point boot_clock::now() {
25#ifdef __ANDROID__
26 timespec ts; 26 timespec ts;
27 clock_gettime(CLOCK_BOOTTIME, &ts); 27 clock_gettime(CLOCK_BOOTTIME, &ts);
28 return boot_clock::time_point(std::chrono::seconds(ts.tv_sec) + 28 return boot_clock::time_point(std::chrono::seconds(ts.tv_sec) +
29 std::chrono::nanoseconds(ts.tv_nsec)); 29 std::chrono::nanoseconds(ts.tv_nsec));
30#else
31 // Darwin does not support clock_gettime.
32 return boot_clock::time_point();
33#endif // __ANDROID__
30} 34}
31#endif
32 35
33} // namespace base 36} // namespace base
34} // namespace android 37} // namespace android