summaryrefslogtreecommitdiff
path: root/gnss
diff options
context:
space:
mode:
authorqctecmdr <qctecmdr@localhost>2019-05-02 14:14:59 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2019-05-02 14:14:59 -0700
commit9b6103421b0ea3a78b37dc974a5f71eb8b9bd5a8 (patch)
tree5aee44143f8ec39363d1fe94c7a6d95d06e11aef /gnss
parent697ee570fe51d3c05652dc3da17a135e80b192d5 (diff)
parent2c71ec9e02ea234106d520717fc36eb4f3ad7c48 (diff)
downloadgps-9b6103421b0ea3a78b37dc974a5f71eb8b9bd5a8.tar.gz
Merge "feat: Add timeuncNs in PQWM1 message"
Diffstat (limited to 'gnss')
-rw-r--r--gnss/GnssAdapter.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp
index 4336691..31cd886 100644
--- a/gnss/GnssAdapter.cpp
+++ b/gnss/GnssAdapter.cpp
@@ -4383,9 +4383,18 @@ bool GnssAdapter::getDebugReport(GnssDebugReport& r)
(int64_t)(reports.mTimeAndClock.back().mLeapSeconds))*1000ULL +
(int64_t)(reports.mTimeAndClock.back().mGpsTowMs);
- r.mTime.timeUncertaintyNs =
- ((float)(reports.mTimeAndClock.back().mTimeUnc) +
- (float)(reports.mTimeAndClock.back().mLeapSecUnc))*1000.0f;
+ if (reports.mTimeAndClock.back().mTimeUncNs > 0) {
+ // TimeUncNs value is available
+ r.mTime.timeUncertaintyNs =
+ (float)(reports.mTimeAndClock.back().mLeapSecUnc)*1000.0f +
+ (float)(reports.mTimeAndClock.back().mTimeUncNs);
+ } else {
+ // fall back to legacy TimeUnc
+ r.mTime.timeUncertaintyNs =
+ ((float)(reports.mTimeAndClock.back().mTimeUnc) +
+ (float)(reports.mTimeAndClock.back().mLeapSecUnc))*1000.0f;
+ }
+
r.mTime.frequencyUncertaintyNsPerSec =
(float)(reports.mTimeAndClock.back().mClockFreqBiasUnc);
LOC_LOGV("getDebugReport - timeestimate=%" PRIu64 " unc=%f frequnc=%f",