diff options
author | Abyss777 <abyss@fox5.ru> | 2018-02-09 12:11:39 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2018-02-09 12:11:39 +0500 |
commit | 267c6e1651b6e0e91dd7c3463f86de929d7bc73c (patch) | |
tree | fc142d1f296623186e55ef0cd51df4219fa8dbc1 /src/org/traccar/protocol/UlbotechProtocolDecoder.java | |
parent | 6d7bc2fe5dfc38dbe25c488501a8f6c653928e33 (diff) | |
download | traccar-server-267c6e1651b6e0e91dd7c3463f86de929d7bc73c.tar.gz traccar-server-267c6e1651b6e0e91dd7c3463f86de929d7bc73c.tar.bz2 traccar-server-267c6e1651b6e0e91dd7c3463f86de929d7bc73c.zip |
Implement unified device timezone handling
Diffstat (limited to 'src/org/traccar/protocol/UlbotechProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/UlbotechProtocolDecoder.java | 12 |
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; |