diff options
author | Linux Build Service Account <lnxbuild@quicinc.com> | 2017-12-25 08:03:44 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-12-25 08:03:44 -0800 |
commit | d519abf0c1c1e25402543e39d2affbd73f8c69b2 (patch) | |
tree | e232e19ecabe255cd9979e5b9ad0ea7a23b5b4b4 /android | |
parent | ce94137dd62684916a323b091cac8c125535d3cd (diff) | |
parent | edcf00043593e125ccc798a70fb6ce2c9318444b (diff) | |
download | gps-d519abf0c1c1e25402543e39d2affbd73f8c69b2.tar.gz |
Merge "Replace wall time"
Diffstat (limited to 'android')
-rw-r--r-- | android/GnssDebug.cpp | 10 |
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; |