sm8450-common: gps: GNSS adapter: need to check validity of elapsed real time
1: Need to check the validity of elapased real time before marking it as valid 2: Increase the allowed time between two get boot time call from 10 micro seconds to 2 milli-seconds Change-Id: If2f7ddb23ce72cb52f294ff44353f5c9a9421a9c CRs-fixed: 3281559
This commit is contained in:
@@ -1171,7 +1171,7 @@ bool ElapsedRealtimeEstimator::getCurrentTime(
|
|||||||
struct timespec sinceBootTime = {};
|
struct timespec sinceBootTime = {};
|
||||||
struct timespec sinceBootTimeTest = {};
|
struct timespec sinceBootTimeTest = {};
|
||||||
bool clockGetTimeSuccess = false;
|
bool clockGetTimeSuccess = false;
|
||||||
const uint32_t MAX_TIME_DELTA_VALUE_NANOS = 10000;
|
const uint32_t MAX_TIME_DELTA_VALUE_NANOS = 2000000; // 2 milli-seconds
|
||||||
const uint32_t MAX_GET_TIME_COUNT = 20;
|
const uint32_t MAX_GET_TIME_COUNT = 20;
|
||||||
/* Attempt to get CLOCK_REALTIME and CLOCK_BOOTIME in succession without an interruption
|
/* Attempt to get CLOCK_REALTIME and CLOCK_BOOTIME in succession without an interruption
|
||||||
or context switch (for up to MAX_GET_TIME_COUNT times) to avoid errors in the calculation */
|
or context switch (for up to MAX_GET_TIME_COUNT times) to avoid errors in the calculation */
|
||||||
|
@@ -428,11 +428,15 @@ void GnssAdapter::fillElapsedRealTime(const GpsLocationExtended& locationExtende
|
|||||||
else if (out.timestamp > 0) {
|
else if (out.timestamp > 0) {
|
||||||
int64_t locationTimeNanos = (int64_t)out.timestamp * 1000000;
|
int64_t locationTimeNanos = (int64_t)out.timestamp * 1000000;
|
||||||
bool isCurDataTimeTrustable = (out.timestamp % mLocPositionMode.min_interval == 0);
|
bool isCurDataTimeTrustable = (out.timestamp % mLocPositionMode.min_interval == 0);
|
||||||
out.flags |= LOCATION_HAS_ELAPSED_REAL_TIME_BIT;
|
int64_t elapsedRealTime = mPositionElapsedRealTimeCal.getElapsedRealtimeEstimateNanos(
|
||||||
out.elapsedRealTime = mPositionElapsedRealTimeCal.getElapsedRealtimeEstimateNanos(
|
|
||||||
locationTimeNanos, isCurDataTimeTrustable,
|
locationTimeNanos, isCurDataTimeTrustable,
|
||||||
(int64_t)mLocPositionMode.min_interval * 1000000);
|
(int64_t)mLocPositionMode.min_interval * 1000000);
|
||||||
out.elapsedRealTimeUnc = mPositionElapsedRealTimeCal.getElapsedRealtimeUncNanos();
|
|
||||||
|
if (elapsedRealTime != -1) {
|
||||||
|
out.flags |= LOCATION_HAS_ELAPSED_REAL_TIME_BIT;
|
||||||
|
out.elapsedRealTime = elapsedRealTime;
|
||||||
|
out.elapsedRealTimeUnc = mPositionElapsedRealTimeCal.getElapsedRealtimeUncNanos();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif //FEATURE_AUTOMOTIVE
|
#endif //FEATURE_AUTOMOTIVE
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user