diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-13 10:27:02 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-13 10:27:02 +1300 |
commit | 797263bfe9655ac82a97954c6930ec4a650a0609 (patch) | |
tree | f3d5605298763d9d20c44ee07fc2a312ee92d084 /src/org/traccar/protocol/Gt06ProtocolDecoder.java | |
parent | f95de7fdb6f9a47618b30a991949b86567d6deb9 (diff) | |
download | trackermap-server-797263bfe9655ac82a97954c6930ec4a650a0609.tar.gz trackermap-server-797263bfe9655ac82a97954c6930ec4a650a0609.tar.bz2 trackermap-server-797263bfe9655ac82a97954c6930ec4a650a0609.zip |
Create date builder util class
Diffstat (limited to 'src/org/traccar/protocol/Gt06ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Gt06ProtocolDecoder.java | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index 6f62baf11..5d79958a5 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.Context; import org.traccar.helper.Checksum; +import org.traccar.helper.DateBuilder; import org.traccar.helper.UnitsConverter; import org.traccar.model.Event; import org.traccar.model.Position; @@ -157,16 +158,10 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(getDeviceId()); position.setProtocol(getProtocolName()); - // Date and time - Calendar time = Calendar.getInstance(timeZone); - time.clear(); - time.set(Calendar.YEAR, 2000 + buf.readUnsignedByte()); - time.set(Calendar.MONTH, buf.readUnsignedByte() - 1); - time.set(Calendar.DAY_OF_MONTH, buf.readUnsignedByte()); - time.set(Calendar.HOUR_OF_DAY, buf.readUnsignedByte()); - time.set(Calendar.MINUTE, buf.readUnsignedByte()); - time.set(Calendar.SECOND, buf.readUnsignedByte()); - position.setTime(time.getTime()); + DateBuilder dateBuilder = new DateBuilder(timeZone) + .setDate(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte()) + .setTime(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte()); + position.setTime(dateBuilder.build()); // GPS length and Satellites count int gpsLength = buf.readUnsignedByte(); |