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
This commit is contained in:
parent
541428a13b
commit
1f9fa7e907
1 changed files with 2 additions and 2 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue