base: make boot_clock work on host linux, hide it on non-linux.
boot_clock was previously returning zero on any platform that doesn't
define __ANDROID__, including host bionic. Instead of returning a bogus
value, just hide it on non-Linux platforms.
Bug: http://b/37758947
Test: libbase_test32/64 on linux
Change-Id: I96e1d8b92dc44c6308408900cf0d27e1e7db5569
diff --git a/base/chrono_utils.cpp b/base/chrono_utils.cpp
index 5eedf3b..d73b551 100644
--- a/base/chrono_utils.cpp
+++ b/base/chrono_utils.cpp
@@ -21,17 +21,14 @@
namespace android {
namespace base {
+#if defined(__linux__)
boot_clock::time_point boot_clock::now() {
-#ifdef __ANDROID__
timespec ts;
clock_gettime(CLOCK_BOOTTIME, &ts);
return boot_clock::time_point(std::chrono::seconds(ts.tv_sec) +
std::chrono::nanoseconds(ts.tv_nsec));
-#else
- // Darwin does not support clock_gettime.
- return boot_clock::time_point();
-#endif // __ANDROID__
}
+#endif
} // namespace base
} // namespace android