Avoid accumulation of missing rouding

This commit is contained in:
sonora 2016-08-08 14:50:58 +02:00
parent fcc07912c2
commit 2e68c4bac7
2 changed files with 2 additions and 2 deletions

View file

@ -77,7 +77,7 @@ public class RouteDirectionInfo {
// expected time after route point
public int getExpectedTime() {
return (int) (distance / averageSpeed);
return (int) Math.round(distance / averageSpeed);
}

View file

@ -873,7 +873,7 @@ public class RouteProvider {
RouteDirectionInfo last = directions.get(directions.size() - 1);
// update speed using time and idstance
last.setAverageSpeed((distanceToEnd[last.routePointOffset] - distanceToEnd[offset])/last.getAverageSpeed());
last.distance = (int) (distanceToEnd[last.routePointOffset] - distanceToEnd[offset]);
last.distance = (int) Math.round(distanceToEnd[last.routePointOffset] - distanceToEnd[offset]);
}
// save time as a speed because we don't know distance of the route segment
float avgSpeed = time;