aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/helper/UnitsConverter.java5
-rw-r--r--src/org/traccar/protocol/MxtProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/SuntechProtocolDecoder.java2
3 files changed, 7 insertions, 2 deletions
diff --git a/src/org/traccar/helper/UnitsConverter.java b/src/org/traccar/helper/UnitsConverter.java
index 74f5a90e6..3dd435df4 100644
--- a/src/org/traccar/helper/UnitsConverter.java
+++ b/src/org/traccar/helper/UnitsConverter.java
@@ -24,6 +24,7 @@ public final class UnitsConverter {
private static final double METERS_TO_FEET_RATIO = 0.3048;
private static final double METERS_TO_MILE_RATIO = 1609.34;
private static final long MILLISECONDS_TO_HOURS_RATIO = 3600000;
+ private static final long MILLISECONDS_TO_MINUTES_RATIO = 60000;
private UnitsConverter() {
}
@@ -80,4 +81,8 @@ public final class UnitsConverter {
return (long) (value * MILLISECONDS_TO_HOURS_RATIO);
}
+ public static long msFromMinutes(long value) {
+ return value * MILLISECONDS_TO_MINUTES_RATIO;
+ }
+
}
diff --git a/src/org/traccar/protocol/MxtProtocolDecoder.java b/src/org/traccar/protocol/MxtProtocolDecoder.java
index d9dcd9e93..a97ae380d 100644
--- a/src/org/traccar/protocol/MxtProtocolDecoder.java
+++ b/src/org/traccar/protocol/MxtProtocolDecoder.java
@@ -145,7 +145,7 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder {
}
if (BitUtil.check(infoGroups, 4)) {
- position.set(Position.KEY_HOURS, buf.readUnsignedInt() * 60000);
+ position.set(Position.KEY_HOURS, UnitsConverter.msFromMinutes(buf.readUnsignedInt()));
}
if (BitUtil.check(infoGroups, 5)) {
diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java
index c6b755770..efaf19b93 100644
--- a/src/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -239,7 +239,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
if (hbm) {
if (index < values.length) {
- position.set(Position.KEY_HOURS, Integer.parseInt(values[index++]) * 60000);
+ position.set(Position.KEY_HOURS, UnitsConverter.msFromMinutes(Integer.parseInt(values[index++])));
}
if (index < values.length) {