aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-02-05 20:47:03 +1000
committerAnton Tananaev <anton.tananaev@gmail.com>2016-02-05 20:47:03 +1000
commit3418c67ac44d7d53ca6855e0d453b1b0d4d0f401 (patch)
tree74845f2b928b171c03fe9bb26b522eb906293cb8 /src/org/traccar
parent7d4923dffbdf4f30dcb397dd5c202cfdace7ea56 (diff)
downloadtraccar-server-3418c67ac44d7d53ca6855e0d453b1b0d4d0f401.tar.gz
traccar-server-3418c67ac44d7d53ca6855e0d453b1b0d4d0f401.tar.bz2
traccar-server-3418c67ac44d7d53ca6855e0d453b1b0d4d0f401.zip
Add ISO time support for OsmAnd (fix #1700)
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/OsmAndProtocolDecoder.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
index f2810c461..e732c6631 100644
--- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java
+++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java
@@ -30,6 +30,7 @@ import org.jboss.netty.handler.codec.http.HttpResponse;
import org.jboss.netty.handler.codec.http.HttpResponseStatus;
import org.jboss.netty.handler.codec.http.HttpVersion;
import org.jboss.netty.handler.codec.http.QueryStringDecoder;
+import org.joda.time.format.ISODateTimeFormat;
import org.traccar.BaseProtocolDecoder;
import org.traccar.model.Event;
import org.traccar.model.Position;
@@ -78,8 +79,13 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder {
}
position.setTime(new Date(timestamp));
} catch (NumberFormatException error) {
- DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- position.setTime(dateFormat.parse(value));
+ if (value.contains("T")) {
+ position.setTime(new Date(
+ ISODateTimeFormat.dateTimeParser().parseMillis(value)));
+ } else {
+ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ position.setTime(dateFormat.parse(value));
+ }
}
break;
case "lat":