diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/CP56Time2a.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/CP56Time2a.java index 6325891e..961f0bb5 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/CP56Time2a.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/utils/security/CP56Time2a.java @@ -40,7 +40,7 @@ public class CP56Time2a { result[2] = (byte) (date.get(Calendar.DAY_OF_MONTH)); result[3] = (byte) (date.get(Calendar.MONTH) + 1); result[4] = (byte) (date.get(Calendar.YEAR) % 100); - return reversehilo.concat(HexUtils.toHex(result)).toString(); + return reversehilo.concat(HexUtils.toHex(result)).substring(0, 14); } public static String decode(byte b[]) { @@ -87,21 +87,13 @@ public class CP56Time2a { Date time = Calendar.getInstance().getTime(); System.out.println(String.format("--未编码--: %s", time)); - String encode = encode(time); - System.out.println("--解码--:" + decode(HexUtils.toBytes(encode))); + String hex = toCp56Hex(time); + System.out.println("--编码1--:" + hex); + System.out.println("--解码1--:" + cp56toDate(hex)); +// String encode = encode(time); +// System.out.println(String.format("--编码2--:%s", encode)); +// System.out.println("--解码2--:" + decode(HexUtils.toBytes(encode))); -// String hex = toCp56Hex(time); -// System.out.println(String.format("--未编码--: %s", time)); -// System.out.println("--编码--:"+hex); -// System.out.println("--解码--:"+cp56toDate(hex)); -// Thread.sleep(10000); -// System.out.println("-----------"); -// System.out.println("-----------"); -// time = Calendar.getInstance().getTime(); -// hex = toCp56Hex(time); -// System.out.println(String.format("--未编码--: %s", time)); -// System.out.println("--编码--:"+hex); -// System.out.println("--解码--:"+cp56toDate(hex)); } }