From 4a95a12fee7237ea7a2a9fef81cf6f8d44413a6d Mon Sep 17 00:00:00 2001 From: xzb <223@qq.com> Date: Fri, 9 Dec 2022 13:18:30 +0800 Subject: [PATCH] iscs v2 --- .../rtss/iscs/convert/LocalDateTimeConvertor.java | 15 --------------- .../rtss/iscs/convert/TimeProtoConvertor.java | 10 +++------- .../joylink/rtss/iscs/memory/MemoryManager.java | 1 + 3 files changed, 4 insertions(+), 22 deletions(-) delete mode 100644 src/main/java/club/joylink/rtss/iscs/convert/LocalDateTimeConvertor.java diff --git a/src/main/java/club/joylink/rtss/iscs/convert/LocalDateTimeConvertor.java b/src/main/java/club/joylink/rtss/iscs/convert/LocalDateTimeConvertor.java deleted file mode 100644 index 760e6e5b3..000000000 --- a/src/main/java/club/joylink/rtss/iscs/convert/LocalDateTimeConvertor.java +++ /dev/null @@ -1,15 +0,0 @@ -package club.joylink.rtss.iscs.convert; - -import com.google.protobuf.Timestamp; - -import java.time.LocalDateTime; -import java.time.ZoneOffset; - -public class LocalDateTimeConvertor { - /** - * @param zoneOffset 如ZoneOffset.ofHours(8) 东8区 - */ - public static LocalDateTime convertFrom(Timestamp from,ZoneOffset zoneOffset){ - return LocalDateTime.ofEpochSecond(from.getSeconds(),from.getNanos(), zoneOffset); - } -} diff --git a/src/main/java/club/joylink/rtss/iscs/convert/TimeProtoConvertor.java b/src/main/java/club/joylink/rtss/iscs/convert/TimeProtoConvertor.java index 4cad138ed..23cb2ff47 100644 --- a/src/main/java/club/joylink/rtss/iscs/convert/TimeProtoConvertor.java +++ b/src/main/java/club/joylink/rtss/iscs/convert/TimeProtoConvertor.java @@ -10,6 +10,9 @@ import java.time.ZoneId; import java.time.ZoneOffset; import java.util.TimeZone; +/** + * java 时间与 proto时间间的相互转换 + */ @Component public class TimeProtoConvertor { private static TimeZone timeZone; @@ -28,11 +31,4 @@ public class TimeProtoConvertor { public static LocalDateTime convertFrom(Timestamp from) { return LocalDateTime.ofInstant(Instant.ofEpochSecond(from.getSeconds(), from.getNanos()), timeZone.toZoneId()); } - - public static void main(String[] args) { - final Timestamp.Builder timestamp = convertFrom(LocalDateTime.now()); - System.out.println(timestamp.build().toString()); - final LocalDateTime now = convertFrom(timestamp.build()); - System.out.println(now.toString()); - } } diff --git a/src/main/java/club/joylink/rtss/iscs/memory/MemoryManager.java b/src/main/java/club/joylink/rtss/iscs/memory/MemoryManager.java index d1e3017c5..7d4956534 100644 --- a/src/main/java/club/joylink/rtss/iscs/memory/MemoryManager.java +++ b/src/main/java/club/joylink/rtss/iscs/memory/MemoryManager.java @@ -35,6 +35,7 @@ public class MemoryManager { private LinkedList alarmEvents = new LinkedList<>(); //////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////// /** * 添加产生的动作事件 */