mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 00:28:42 +00:00
fix PWX export: handle end of gaps gracefully.
As I got it pwx by itself has no concept of recording intervals. "smart recording" and other strange data require variable recoring intervals. On the other hand it's not recording the duration of a sample explicitly. This means the duration needs to be derived from the previous samples timestamp (assuming the sample timestamps are referring to the end of the sampled period). This diff writes an empty timestamp at the end of each gap so that the next real sample/ridepoint can calculate the correct duration. Please note that this may unhide some deficiencies in GCs file reading in exports.
This commit is contained in:
committed by
Gareth Coco
parent
e57ab8a689
commit
ee4b2221f7
@@ -486,7 +486,21 @@ PwxFileReader::writeRideFile(MainWindow *main, const RideFile *ride, QFile &file
|
||||
// samples
|
||||
// data points: timeoffset, dist, hr, spd, pwr, torq, cad, lat, lon, alt
|
||||
if (!ride->dataPoints().empty()) {
|
||||
int secs = 0;
|
||||
|
||||
foreach (const RideFilePoint *point, ride->dataPoints()) {
|
||||
// if there was a gap, log time when this sample started:
|
||||
if( secs + ride->recIntSecs() < point->secs ){
|
||||
QDomElement sample = doc.createElement("sample");
|
||||
root.appendChild(sample);
|
||||
|
||||
QDomElement timeoffset = doc.createElement("timeoffset");
|
||||
text = doc.createTextNode(QString("%1")
|
||||
.arg((int)point->secs - ride->recIntSecs() ));
|
||||
timeoffset.appendChild(text);
|
||||
sample.appendChild(timeoffset);
|
||||
}
|
||||
|
||||
QDomElement sample = doc.createElement("sample");
|
||||
root.appendChild(sample);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user