aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/UlbotechProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/protocol/UlbotechProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/UlbotechProtocolDecoder.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/main/java/org/traccar/protocol/UlbotechProtocolDecoder.java
index e6cc0a891..c9b35158e 100644
--- a/src/main/java/org/traccar/protocol/UlbotechProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/UlbotechProtocolDecoder.java
@@ -37,6 +37,7 @@ import org.traccar.model.Position;
import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.Date;
+import java.util.TimeZone;
import java.util.regex.Pattern;
public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
@@ -214,16 +215,17 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- if (deviceSession.getTimeZone() == null) {
- deviceSession.setTimeZone(getTimeZone(deviceSession.getDeviceId()));
+ if (!deviceSession.contains(DeviceSession.KEY_TIMEZONE)) {
+ deviceSession.set(DeviceSession.KEY_TIMEZONE, getTimeZone(deviceSession.getDeviceId()));
}
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
+ TimeZone timeZone = deviceSession.get(DeviceSession.KEY_TIMEZONE);
long seconds = buf.readUnsignedInt() & 0x7fffffffL;
seconds += 946684800L; // 2000-01-01 00:00
- seconds -= deviceSession.getTimeZone().getRawOffset() / 1000;
+ seconds -= timeZone.getRawOffset() / 1000;
Date time = new Date(seconds * 1000);
boolean hasLocation = false;