From 64cfb89dcd87280559ec6d5867c8f309b9df4181 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 13 Sep 2015 10:53:00 +1200 Subject: Fix OsmAnd timestamp issue --- src/org/traccar/protocol/OsmAndProtocolDecoder.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/org/traccar/protocol') diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java index f89406a00..cf447c579 100644 --- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java +++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java @@ -69,7 +69,11 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder { position.setValid(true); if (params.containsKey("timestamp")) { try { - position.setTime(new Date(Long.valueOf(params.get("timestamp").get(0)) * 1000)); + long timestamp = Long.valueOf(params.get("timestamp").get(0)); + if (timestamp < Integer.MAX_VALUE) { + timestamp *= 1000; + } + position.setTime(new Date(timestamp)); } catch (NumberFormatException error) { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); position.setTime(dateFormat.parse(params.get("timestamp").get(0))); -- cgit v1.2.3