aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/DistanceHandler.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/org/traccar/DistanceHandler.java b/src/org/traccar/DistanceHandler.java
index 57dddfe87..6232c555f 100644
--- a/src/org/traccar/DistanceHandler.java
+++ b/src/org/traccar/DistanceHandler.java
@@ -15,12 +15,12 @@
*/
package org.traccar;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
import org.traccar.helper.DistanceCalculator;
import org.traccar.model.Event;
import org.traccar.model.Position;
-import java.math.BigDecimal;
-
public class DistanceHandler extends BaseDataHandler {
private Position getLastPosition(long deviceId) {
@@ -44,7 +44,7 @@ public class DistanceHandler extends BaseDataHandler {
position.getLatitude(), position.getLongitude(),
last.getLatitude(), last.getLongitude());
- distance = BigDecimal.valueOf(distance).setScale(2).doubleValue();
+ distance = BigDecimal.valueOf(distance).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
}
position.set(Event.KEY_DISTANCE, distance);