fix rounding of average speed in GPX analysis

This commit is contained in:
sonora 2015-07-18 17:05:07 +02:00
parent dc2529acf0
commit c8f20c0605

View file

@ -1,3 +1,4 @@
package net.osmand.plus;
import java.io.BufferedInputStream;
@ -305,9 +306,9 @@ public class GPXUtilities {
// 5. Max speed and Average speed, if any. Average speed is NOT overall (effective) speed, but only calculated for "moving" periods.
if(speedCount > 0) {
if(timeMoving > 0){
avgSpeed = (float) (totalDistanceMoving / timeMoving * 1000);
avgSpeed = (float)totalDistanceMoving / (float)timeMoving * 1000;
} else {
avgSpeed = (float) (totalSpeedSum / speedCount);
avgSpeed = (float)totalSpeedSum / (float)speedCount;
}
} else {
avgSpeed = -1;