From ca6f0882c1c677ecd4b0c53ea77d124bb753bdca Mon Sep 17 00:00:00 2001 From: Walter Date: Sat, 18 Jan 2014 23:32:51 +0100 Subject: [PATCH] using milliseconds for delta_t when calculating speed, supports Suunto Ambit gpx datafiles --- src/GpxParser.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/GpxParser.cpp b/src/GpxParser.cpp index 7b88ccdff..83f15631d 100644 --- a/src/GpxParser.cpp +++ b/src/GpxParser.cpp @@ -170,7 +170,8 @@ bool // compute the elapsed time and distance traveled since the // last recorded trackpoint - double delta_t = last_time.secsTo(time); + // use msec in case there are msec in QDateTime + double delta_t_ms = last_time.msecsTo(time); if (delta_d<0) { delta_d=0; @@ -181,9 +182,9 @@ bool // for the first trackpoint -- so set speed to 0.0 instead of // dividing by zero. double speed = 0.0; - if (delta_t > 0.0) + if (delta_t_ms > 0.0) { - speed=delta_d / delta_t * 3600.0; + speed= 1000.0 * delta_d / delta_t_ms * 3600.0; } // Time from beginning of activity