diff options
-rw-r--r-- | src/positioning/qnmeapositioninfosource.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/positioning/qnmeapositioninfosource.cpp b/src/positioning/qnmeapositioninfosource.cpp index 27711323..63410022 100644 --- a/src/positioning/qnmeapositioninfosource.cpp +++ b/src/positioning/qnmeapositioninfosource.cpp @@ -243,16 +243,18 @@ static int processSentence(QGeoPositionInfo &info, // the sentences containing the full timestamp (e.g., GPRMC) *first* ! if (infoTime.isValid()) { if (pos.timestamp().time().isValid()) { - if (infoTime != pos.timestamp().time() || - (infoDate.isValid() // if time is valid but one date or both are not, match only on time + if (infoTime < pos.timestamp().time() || + (infoDate.isValid() // if time is valid but one date or both are not, && pos.timestamp().date().isValid() - && infoDate != pos.timestamp().date())) { - // Effectively read data for different update, so copy buf into m_nextLine + && infoDate < pos.timestamp().date())) { + // Effectively read data for different update, that is also newer, so copy buf into m_nextLine m_nextLine = QByteArray(buf, size); break; } else { - // timestamps match -- merge into info - mergePositions(info, pos, QByteArray(buf, size)); + if (infoTime == pos.timestamp().time()) + // timestamps match -- merge into info + mergePositions(info, pos, QByteArray(buf, size)); + // else discard out of order outdated info. } } else { // no timestamp available -- merge into info |