aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-02-24 21:57:11 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-02-24 21:57:11 +1300
commitfcd74ee0e418a82fe118920d67c824bbfbe984a2 (patch)
treebfa93cbaebcd7e4b8ef678a702963f2f53796b98
parentb6b565858154dd8293829ee7f4d982178d97a0a3 (diff)
downloadtraccar-server-fcd74ee0e418a82fe118920d67c824bbfbe984a2.tar.gz
traccar-server-fcd74ee0e418a82fe118920d67c824bbfbe984a2.tar.bz2
traccar-server-fcd74ee0e418a82fe118920d67c824bbfbe984a2.zip
Check time before updating current location
-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);
+ }
}
}