1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +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)
{
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);