summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Tang <zhikait@codeaurora.org>2020-01-10 12:17:36 -0800
committerKevin Tang <zhikait@codeaurora.org>2020-01-14 12:16:50 -0800
commit77ad909cdfc1c278cdbfdb915e3384b12109dd16 (patch)
tree258fd84ffff0a980ecc541da3112b8f30359266d
parent8400fc771740f62536e454ecf97289d689158043 (diff)
downloadgps-77ad909cdfc1c278cdbfdb915e3384b12109dd16.tar.gz
alias elapsedRealtime for le pla
elapsedRealtime is under android namespace. To make it common for le and android, we alias elapsedRealtime so that android namespace comes with it. for LE build, we defined elapsedRealtime. Change-Id: Iaa1a2113d0783d31cb8a6f617b158ec264b9d955 CRs-Fixed: 2598670
-rw-r--r--pla/android/loc_pla.h3
-rw-r--r--pla/oe/loc_pla.h11
2 files changed, 11 insertions, 3 deletions
diff --git a/pla/android/loc_pla.h b/pla/android/loc_pla.h
index 6104bfb..1b99739 100644
--- a/pla/android/loc_pla.h
+++ b/pla/android/loc_pla.h
@@ -31,7 +31,8 @@
#ifdef __cplusplus
#include <utils/SystemClock.h>
-#define uptimeMillis android::uptimeMillis
+#define uptimeMillis() android::uptimeMillis()
+#define elapsedRealtime() android::elapsedRealtime()
#endif
#ifdef __cplusplus
diff --git a/pla/oe/loc_pla.h b/pla/oe/loc_pla.h
index e795a23..bbdb0bd 100644
--- a/pla/oe/loc_pla.h
+++ b/pla/oe/loc_pla.h
@@ -37,16 +37,23 @@
#include <sys/time.h>
#include <time.h>
-inline int64_t uptimeMillis()
+inline int64_t sysTimeMillis(int clock)
{
struct timespec ts;
int64_t time_ms = 0;
- clock_gettime(CLOCK_BOOTTIME, &ts);
+ clock_gettime(clock, &ts);
time_ms += (ts.tv_sec * 1000000000LL);
time_ms += ts.tv_nsec + 500000LL;
return time_ms / 1000000LL;
}
+inline int64_t uptimeMillis() {
+ return sysTimeMillis(CLOCK_MONOTONIC);
+}
+inline int64_t elapsedRealtime() {
+ return sysTimeMillis(CLOCK_BOOTTIME);
+}
+
extern "C" {
#endif