aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-03-10 12:47:36 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-03-10 12:47:36 +1300
commite69316a43169e16d1cb347536177886ed5785873 (patch)
tree2d11a25fabbac4e6a87988df8f57bce845279c73
parent2cb5e686486cfdcec425d4a29e4818533bcf154a (diff)
downloadtrackermap-server-e69316a43169e16d1cb347536177886ed5785873.tar.gz
trackermap-server-e69316a43169e16d1cb347536177886ed5785873.tar.bz2
trackermap-server-e69316a43169e16d1cb347536177886ed5785873.zip
Fix GPS103 time bug
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java2
-rw-r--r--test/org/traccar/protocol/Gps103ProtocolDecoderTest.java3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index 2e3620179..9646a5e6c 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -126,7 +126,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
int deltaMinutes = (localHours - utcHours) * 60 + localMinutes - utcMinutes;
if (deltaMinutes <= -12 * 60) {
deltaMinutes += 24 * 60;
- } else if (deltaMinutes > 12) {
+ } else if (deltaMinutes > 12 * 60) {
deltaMinutes -= 24 * 60;
}
time.add(Calendar.MINUTE, -deltaMinutes);
diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
index 2e3929b28..923d92b31 100644
--- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
@@ -82,6 +82,9 @@ public class Gps103ProtocolDecoderTest {
assertNotNull(decoder.decode(null, null,
"imei:863070010423167,tracker,1211060621,,F,062152.000,A,2220.6914,N,11407.5506,E,15.85,347.84,"));
+
+ assertNotNull(decoder.decode(null, null,
+ "imei:863070012698733,tracker,1303092334,,F,193427.000,A,5139.0369,N,03907.2791,E,0.00,,"));
}
}