Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f9fa7e9 authored by Mark Salyzyn's avatar Mark Salyzyn
Browse files

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
parent 541428a1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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) {