diff --git a/src/data/igcparser.cpp b/src/data/igcparser.cpp index 3b13f4cf..6563b39a 100644 --- a/src/data/igcparser.cpp +++ b/src/data/igcparser.cpp @@ -126,11 +126,12 @@ bool IGCParser::readBRecord(SegmentData &segment, const char *line, int len) { qreal lat, lon, ele; + QTime time; if (len < 35) return false; - if (!readTimestamp(line + 1, _time)) { + if (!readTimestamp(line + 1, time)) { _errorString = "Invalid timestamp"; return false; } @@ -149,6 +150,11 @@ bool IGCParser::readBRecord(SegmentData &segment, const char *line, return false; } + if (time < _time && !segment.isEmpty() + && _date == segment.last().timestamp().date()) + _date = _date.addDays(1); + _time = time; + Trackpoint t(Coordinates(lon, lat)); t.setTimestamp(QDateTime(_date, _time, Qt::UTC)); t.setElevation(ele);