aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/UlbotechProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-02-10 08:24:14 +1300
committerGitHub <noreply@github.com>2018-02-10 08:24:14 +1300
commite1bd30161e842b61e395e932ec9251a326025ad8 (patch)
treefc142d1f296623186e55ef0cd51df4219fa8dbc1 /src/org/traccar/protocol/UlbotechProtocolDecoder.java
parent96e45b5a990182ddc4b878e48d93d301d014427a (diff)
parent267c6e1651b6e0e91dd7c3463f86de929d7bc73c (diff)
downloadtraccar-server-e1bd30161e842b61e395e932ec9251a326025ad8.tar.gz
traccar-server-e1bd30161e842b61e395e932ec9251a326025ad8.tar.bz2
traccar-server-e1bd30161e842b61e395e932ec9251a326025ad8.zip
Merge pull request #3765 from Abyss777/device_timezone
Unified Device timezone handling
Diffstat (limited to 'src/org/traccar/protocol/UlbotechProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/UlbotechProtocolDecoder.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
index f5ca9190b..5499518a1 100644
--- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java
+++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2018 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.
@@ -19,7 +19,6 @@ import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
-import org.traccar.Context;
import org.traccar.DeviceSession;
import org.traccar.helper.BitUtil;
import org.traccar.helper.Checksum;
@@ -39,11 +38,8 @@ import java.util.regex.Pattern;
public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
- private final long timeZone;
-
public UlbotechProtocolDecoder(UlbotechProtocol protocol) {
super(protocol);
- timeZone = Context.getConfig().getInteger(getProtocolName() + ".timezone", 0);
}
private static final short DATA_GPS = 0x01;
@@ -215,12 +211,16 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
return null;
}
+ if (deviceSession.getTimeZone() == null) {
+ deviceSession.setTimeZone(getTimeZone(deviceSession.getDeviceId()));
+ }
+
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
long seconds = buf.readUnsignedInt() & 0x7fffffffL;
seconds += 946684800L; // 2000-01-01 00:00
- seconds -= timeZone;
+ seconds -= deviceSession.getTimeZone().getRawOffset() / 1000;
Date time = new Date(seconds * 1000);
boolean hasLocation = false;