Fit files sometimes go backwards

FIT record type '253' occasionally causes time to go
backwards, this might be a decoding error, but for now
we force time to go forward anyway.

Looking at bad files GPS data with this patch suggests
this is the correct behaviour.

Fixes #104.
This commit is contained in:
Mark Liversedge
2011-08-06 17:45:20 +01:00
parent 083569af5c
commit 1d7696fb6a

View File

@@ -326,7 +326,11 @@ struct FitFileReaderState
continue;
switch (field.num) {
case 253: time = value + qbase_time.toTime_t(); break;
case 253: time = value + qbase_time.toTime_t();
// Time MUST NOT go backwards
// You canny break the laws of physics, Jim
if (time < last_time) time = last_time;
break;
case 0: lati = value; break;
case 1: lngi = value; break;
case 2: alt = value / 5.0 - 500.0; break;