diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java | 6 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java index c11c97df3..534937235 100644 --- a/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java @@ -26,9 +26,11 @@ import org.traccar.model.Position; import org.traccar.model.WifiAccessPoint; import java.net.SocketAddress; +import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.TimeZone; public class MictrackProtocolDecoder extends BaseProtocolDecoder { @@ -37,7 +39,9 @@ public class MictrackProtocolDecoder extends BaseProtocolDecoder { } private Date decodeTime(String data) throws ParseException { - return new SimpleDateFormat("yyMMddHHmmss").parse(data); + DateFormat dateFormat = new SimpleDateFormat("yyMMddHHmmss"); + dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + return dateFormat.parse(data); } private void decodeLocation(Position position, String data) throws ParseException { diff --git a/src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java index d388d935b..bbdb05071 100644 --- a/src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java @@ -12,7 +12,7 @@ public class MictrackProtocolDecoderTest extends ProtocolTest { verifyPosition(decoder, text( "MT;6;866425031361423;R0;10+190109091803+22.63827+114.02922+2.14+69+2+3744+113"), - position("2019-01-09 17:18:03.000", true, 22.63827, 114.02922)); + position("2019-01-09 09:18:03.000", true, 22.63827, 114.02922)); verifyAttributes(decoder, text( "MT;6;866425031377981;R1;190108024848+6a:db:54:5a:79:6d,-91,00:9a:cd:a2:e6:21,-94+3+3831+0")); |