summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2017-10-03 14:50:00 -0500
committerMark Salyzyn2017-10-03 16:53:26 -0500
commit1f9fa7e907bf23d84d06d8543811234187614fa4 (patch)
tree5a0bd1be470bcb756ce876cb903bde841dbae7fb /base/chrono_utils.cpp
parent541428a13b8976b58893d6427c94b36084514546 (diff)
downloadplatform-system-core-1f9fa7e907bf23d84d06d8543811234187614fa4.tar.gz
platform-system-core-1f9fa7e907bf23d84d06d8543811234187614fa4.tar.xz
platform-system-core-1f9fa7e907bf23d84d06d8543811234187614fa4.zip
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 b6bf701ea..dbe54830f 100644
--- a/base/chrono_utils.cpp
+++ b/base/chrono_utils.cpp
@@ -22,7 +22,7 @@ namespace android {
22namespace base { 22namespace base {
23 23
24boot_clock::time_point boot_clock::now() { 24boot_clock::time_point boot_clock::now() {
25#ifdef __ANDROID__ 25#ifdef __linux__
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) +
@@ -30,7 +30,7 @@ boot_clock::time_point boot_clock::now() {
30#else 30#else
31 // Darwin does not support clock_gettime. 31 // Darwin does not support clock_gettime.
32 return boot_clock::time_point(); 32 return boot_clock::time_point();
33#endif // __ANDROID__ 33#endif // __linux__
34} 34}
35 35
36std::ostream& operator<<(std::ostream& os, const Timer& t) { 36std::ostream& operator<<(std::ostream& os, const Timer& t) {