summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@quicinc.com>2017-12-25 08:03:44 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2017-12-25 08:03:44 -0800
commitd519abf0c1c1e25402543e39d2affbd73f8c69b2 (patch)
treee232e19ecabe255cd9979e5b9ad0ea7a23b5b4b4 /android
parentce94137dd62684916a323b091cac8c125535d3cd (diff)
parentedcf00043593e125ccc798a70fb6ce2c9318444b (diff)
downloadgps-d519abf0c1c1e25402543e39d2affbd73f8c69b2.tar.gz
Merge "Replace wall time"
Diffstat (limited to 'android')
-rw-r--r--android/GnssDebug.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/android/GnssDebug.cpp b/android/GnssDebug.cpp
index ff467d3..3d2b8bd 100644
--- a/android/GnssDebug.cpp
+++ b/android/GnssDebug.cpp
@@ -79,13 +79,11 @@ Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
data.position.bearingAccuracyDegrees =
reports.mLocation.bearingAccuracyDegrees;
- timeval tv_now, tv_report;
- tv_report.tv_sec = reports.mLocation.mUtcReported.tv_sec;
- tv_report.tv_usec = reports.mLocation.mUtcReported.tv_nsec / 1000ULL;
- gettimeofday(&tv_now, NULL);
+ struct timespec tv_now;
+ clock_gettime(CLOCK_MONOTONIC, &tv_now);
data.position.ageSeconds =
- (tv_now.tv_sec - tv_report.tv_sec) +
- (float)((tv_now.tv_usec - tv_report.tv_usec)) / 1000000;
+ (tv_now.tv_sec - reports.mLocation.mUtcReported.tv_sec) +
+ (float)((tv_now.tv_nsec - reports.mLocation.mUtcReported.tv_nsec)) / 1000000000LL;
}
else {
data.position.valid = false;