diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-09-17 15:50:19 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-09-17 15:50:19 +1200 |
commit | 7e2ed343d2a6a03938c3f074417464c63d31fd59 (patch) | |
tree | 61dd514f7618ac07b56ccfd84f607e3d8b7c4b98 /src/org/traccar/protocol/H02ProtocolEncoder.java | |
parent | da5286acb0c81f5b9bfe92eaa30e9759e3fff6b5 (diff) | |
download | trackermap-server-7e2ed343d2a6a03938c3f074417464c63d31fd59.tar.gz trackermap-server-7e2ed343d2a6a03938c3f074417464c63d31fd59.tar.bz2 trackermap-server-7e2ed343d2a6a03938c3f074417464c63d31fd59.zip |
Remove joda time library
Diffstat (limited to 'src/org/traccar/protocol/H02ProtocolEncoder.java')
-rw-r--r-- | src/org/traccar/protocol/H02ProtocolEncoder.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/H02ProtocolEncoder.java b/src/org/traccar/protocol/H02ProtocolEncoder.java index 87fad6016..6d5cfb298 100644 --- a/src/org/traccar/protocol/H02ProtocolEncoder.java +++ b/src/org/traccar/protocol/H02ProtocolEncoder.java @@ -16,19 +16,19 @@ */ package org.traccar.protocol; -import org.joda.time.DateTime; -import org.joda.time.DateTimeZone; import org.traccar.StringProtocolEncoder; import org.traccar.model.Command; +import java.util.Date; + public class H02ProtocolEncoder extends StringProtocolEncoder { private static final String MARKER = "HQ"; - private Object formatCommand(DateTime time, String uniqueId, String type, String... params) { + private Object formatCommand(Date time, String uniqueId, String type, String... params) { - StringBuilder result = new StringBuilder(String.format("*%s,%s,%s,%02d%02d%02d", - MARKER, uniqueId, type, time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute())); + StringBuilder result = new StringBuilder( + String.format("*%s,%s,%s,%4$tH%4$tM%4$tS", MARKER, uniqueId, type, time)); for (String param : params) { result.append(",").append(param); @@ -39,7 +39,7 @@ public class H02ProtocolEncoder extends StringProtocolEncoder { return result.toString(); } - protected Object encodeCommand(Command command, DateTime time) { + protected Object encodeCommand(Command command, Date time) { String uniqueId = getUniqueId(command.getDeviceId()); switch (command.getType()) { @@ -62,7 +62,7 @@ public class H02ProtocolEncoder extends StringProtocolEncoder { @Override protected Object encodeCommand(Command command) { - return encodeCommand(command, new DateTime(DateTimeZone.UTC)); + return encodeCommand(command, new Date()); } } |