aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-30 16:53:14 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-30 16:53:14 +1200
commitdaa6e21a9d52d3705165e6cfb7cc32a761109b45 (patch)
treea2f3e22a33437387fa2e6227a66056d5951eac55
parentd97c74a7cf0efe5f4209e31a998b97fc1be8023b (diff)
downloadtrackermap-server-daa6e21a9d52d3705165e6cfb7cc32a761109b45.tar.gz
trackermap-server-daa6e21a9d52d3705165e6cfb7cc32a761109b45.tar.bz2
trackermap-server-daa6e21a9d52d3705165e6cfb7cc32a761109b45.zip
Add Ulbotech time zone offset
-rw-r--r--src/org/traccar/protocol/UlbotechProtocolDecoder.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
index 1de3b50b9..a94da7be7 100644
--- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java
+++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
@@ -20,6 +20,7 @@ import java.util.Date;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.Context;
import org.traccar.helper.ChannelBufferTools;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Event;
@@ -27,8 +28,14 @@ import org.traccar.model.Position;
public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
+ private long timeZone;
+
public UlbotechProtocolDecoder(UlbotechProtocol protocol) {
super(protocol);
+
+ if (Context.getConfig().hasKey(protocol + ".timezone")) {
+ timeZone = Context.getConfig().getInteger(protocol + ".timezone");
+ }
}
private static final short DATA_GPS = 0x01;
@@ -68,6 +75,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
// Time
long seconds = buf.readUnsignedInt() & 0x7fffffffl;
seconds += 946684800l; // 2000-01-01 00:00
+ seconds -= timeZone;
position.setTime(new Date(seconds * 1000));
boolean hasLocation = false;