aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/MainEventHandler.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/org/traccar/MainEventHandler.java b/src/org/traccar/MainEventHandler.java
index f0ef36e5b..f99765de4 100644
--- a/src/org/traccar/MainEventHandler.java
+++ b/src/org/traccar/MainEventHandler.java
@@ -48,7 +48,10 @@ public class MainEventHandler extends IdleStateAwareChannelHandler {
s.append("course: ").append(String.format("%.1f", position.getCourse()));
Log.info(s.toString());
- Context.getConnectionManager().updatePosition(position);
+ Position lastPosition = Context.getConnectionManager().getLastPosition(position.getDeviceId());
+ if (lastPosition == null || position.getFixTime().compareTo(lastPosition.getFixTime()) > 0) {
+ Context.getConnectionManager().updatePosition(position);
+ }
}
}