aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-08-10 07:02:55 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-08-10 07:02:55 +1200
commitea1b94b524c880927f85fd0c94a26bd3ec17c898 (patch)
treebf9f05c4871536fa50aec3792e532337c95826e5 /src/org/traccar
parentdb4a0e37769198a20fd3e14552b88de1446cd6b5 (diff)
downloadtrackermap-server-ea1b94b524c880927f85fd0c94a26bd3ec17c898.tar.gz
trackermap-server-ea1b94b524c880927f85fd0c94a26bd3ec17c898.tar.bz2
trackermap-server-ea1b94b524c880927f85fd0c94a26bd3ec17c898.zip
Support seconds for Tramigo
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/TramigoProtocolDecoder.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/TramigoProtocolDecoder.java b/src/org/traccar/protocol/TramigoProtocolDecoder.java
index b39e3eab1..b1e28e17d 100644
--- a/src/org/traccar/protocol/TramigoProtocolDecoder.java
+++ b/src/org/traccar/protocol/TramigoProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2014 - 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.
@@ -130,12 +130,13 @@ public class TramigoProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromKph(Double.parseDouble(matcher.group(2))));
}
- pattern = Pattern.compile("(\\d{1,2}:\\d{2} \\w{3} \\d{1,2})");
+ pattern = Pattern.compile("(\\d{1,2}:\\d{2}(:\\d{2})? \\w{3} \\d{1,2})");
matcher = pattern.matcher(sentence);
if (!matcher.find()) {
return null;
}
- DateFormat dateFormat = new SimpleDateFormat("HH:mm MMM d yyyy", Locale.ENGLISH);
+ DateFormat dateFormat = new SimpleDateFormat(
+ matcher.group(2) != null ? "HH:mm:ss MMM d yyyy" : "HH:mm MMM d yyyy", Locale.ENGLISH);
position.setTime(DateUtil.correctYear(
dateFormat.parse(matcher.group(1) + " " + Calendar.getInstance().get(Calendar.YEAR))));