1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 13:41:16 +01:00

A better date boundary handling fix (#192)

This commit is contained in:
Martin Tůma 2019-03-10 18:16:43 +01:00
parent c5cdf81f14
commit b13590450d

View File

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