aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/ConnectionManager.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-08-10 09:03:02 +0500
committerAbyss777 <abyss@fox5.ru>2017-08-10 09:03:02 +0500
commit34faf7e1d024596b388d1dd3a062f19adde0027c (patch)
treed324c1a602a4b8e5034785896076fd73a24811b4 /src/org/traccar/database/ConnectionManager.java
parent94a922eaf167a73a0188255398fb1c6799767e18 (diff)
downloadtrackermap-server-34faf7e1d024596b388d1dd3a062f19adde0027c.tar.gz
trackermap-server-34faf7e1d024596b388d1dd3a062f19adde0027c.tar.bz2
trackermap-server-34faf7e1d024596b388d1dd3a062f19adde0027c.zip
Rename variables
Diffstat (limited to 'src/org/traccar/database/ConnectionManager.java')
-rw-r--r--src/org/traccar/database/ConnectionManager.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/org/traccar/database/ConnectionManager.java b/src/org/traccar/database/ConnectionManager.java
index b3b00fefa..1c5d4428a 100644
--- a/src/org/traccar/database/ConnectionManager.java
+++ b/src/org/traccar/database/ConnectionManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -149,15 +149,15 @@ public class ConnectionManager {
}
Event result = null;
Boolean oldMotion = deviceState.getMotionState();
- long currentTime = new Date().getTime();
+ long currentTime = System.currentTimeMillis();
boolean newMotion = !oldMotion;
- Position potentialPosition = deviceState.getMotionPosition();
- if (potentialPosition != null) {
- long potentialTime = potentialPosition.getFixTime().getTime()
+ Position motionPosition = deviceState.getMotionPosition();
+ if (motionPosition != null) {
+ long motionTime = motionPosition.getFixTime().getTime()
+ (newMotion ? tripsConfig.getMinimalTripDuration() : tripsConfig.getMinimalParkingDuration());
- if (potentialTime <= currentTime) {
+ if (motionTime <= currentTime) {
String eventType = newMotion ? Event.TYPE_DEVICE_MOVING : Event.TYPE_DEVICE_STOPPED;
- result = new Event(eventType, potentialPosition.getDeviceId(), potentialPosition.getId());
+ result = new Event(eventType, motionPosition.getDeviceId(), motionPosition.getId());
deviceState.setMotionState(newMotion);
deviceState.setMotionPosition(null);
}