From fcd74ee0e418a82fe118920d67c824bbfbe984a2 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 24 Feb 2016 21:57:11 +1300 Subject: Check time before updating current location --- src/org/traccar/MainEventHandler.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); + } } } -- cgit v1.2.3