summaryrefslogtreecommitdiff
path: root/base/chrono_utils.cpp
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2017-10-03 12:50:00 -0700
committerMark Salyzyn <salyzyn@google.com>2017-10-03 14:53:26 -0700
commit1f9fa7e907bf23d84d06d8543811234187614fa4 (patch)
tree5a0bd1be470bcb756ce876cb903bde841dbae7fb /base/chrono_utils.cpp
parent541428a13b8976b58893d6427c94b36084514546 (diff)
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
Diffstat (limited to 'base/chrono_utils.cpp')
-rw-r--r--base/chrono_utils.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/base/chrono_utils.cpp b/base/chrono_utils.cpp
index b6bf701eac..dbe54830f6 100644
--- a/base/chrono_utils.cpp
+++ b/base/chrono_utils.cpp
@@ -22,7 +22,7 @@ namespace android {
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 @@ boot_clock::time_point boot_clock::now() {
#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) {