base: chrono_utils: supported in linux
Tried to use this on host executable, and it always read back zero
for duration. Expanded code to support any linux build.
Test: works on host
Bug: 38446744
Bug: 66912053
Change-Id: I4a2cbbfff3e7739b54cb6c6e877898de4d3d2296
diff --git a/base/chrono_utils.cpp b/base/chrono_utils.cpp
index b6bf701..dbe5483 100644
--- a/base/chrono_utils.cpp
+++ b/base/chrono_utils.cpp
@@ -22,7 +22,7 @@
namespace base {
boot_clock::time_point boot_clock::now() {
-#ifdef __ANDROID__
+#ifdef __linux__
timespec ts;
clock_gettime(CLOCK_BOOTTIME, &ts);
return boot_clock::time_point(std::chrono::seconds(ts.tv_sec) +
@@ -30,7 +30,7 @@
#else
// Darwin does not support clock_gettime.
return boot_clock::time_point();
-#endif // __ANDROID__
+#endif // __linux__
}
std::ostream& operator<<(std::ostream& os, const Timer& t) {