aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-08-11 19:24:16 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-08-11 19:24:16 -0700
commit6ced867cad974c3b75b9ade45ba8bda038e6155e (patch)
tree7df3a43e339ac7abcda6850c707fa70a9d1597ee /src/main/java/org/traccar
parent0caa8a3f3e0a97a974b4f17ea6d7ba97e6945e35 (diff)
downloadtrackermap-server-6ced867cad974c3b75b9ade45ba8bda038e6155e.tar.gz
trackermap-server-6ced867cad974c3b75b9ade45ba8bda038e6155e.tar.bz2
trackermap-server-6ced867cad974c3b75b9ade45ba8bda038e6155e.zip
Fix division by zero
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/handler/events/BehaviorEventHandler.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/handler/events/BehaviorEventHandler.java b/src/main/java/org/traccar/handler/events/BehaviorEventHandler.java
index 47f5def09..767cef3f6 100644
--- a/src/main/java/org/traccar/handler/events/BehaviorEventHandler.java
+++ b/src/main/java/org/traccar/handler/events/BehaviorEventHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2021 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.
@@ -44,7 +44,7 @@ public class BehaviorEventHandler extends BaseEventHandler {
protected Map<Event, Position> analyzePosition(Position position) {
Position lastPosition = identityManager.getLastPosition(position.getDeviceId());
- if (lastPosition != null) {
+ if (lastPosition != null && position.getFixTime().equals(lastPosition.getFixTime())) {
double acceleration = UnitsConverter.mpsFromKnots(position.getSpeed() - lastPosition.getSpeed()) * 1000
/ (position.getFixTime().getTime() - lastPosition.getFixTime().getTime());
if (accelerationThreshold != 0 && acceleration >= accelerationThreshold) {