Avoid accumulation of missing rouding
This commit is contained in:
parent
fcc07912c2
commit
2e68c4bac7
2 changed files with 2 additions and 2 deletions
|
@ -77,7 +77,7 @@ public class RouteDirectionInfo {
|
||||||
|
|
||||||
// expected time after route point
|
// expected time after route point
|
||||||
public int getExpectedTime() {
|
public int getExpectedTime() {
|
||||||
return (int) (distance / averageSpeed);
|
return (int) Math.round(distance / averageSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -873,7 +873,7 @@ public class RouteProvider {
|
||||||
RouteDirectionInfo last = directions.get(directions.size() - 1);
|
RouteDirectionInfo last = directions.get(directions.size() - 1);
|
||||||
// update speed using time and idstance
|
// update speed using time and idstance
|
||||||
last.setAverageSpeed((distanceToEnd[last.routePointOffset] - distanceToEnd[offset])/last.getAverageSpeed());
|
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
|
// save time as a speed because we don't know distance of the route segment
|
||||||
float avgSpeed = time;
|
float avgSpeed = time;
|
||||||
|
|
Loading…
Reference in a new issue