From 3d68b56bb5ecbc3d34b2901c671dc7f1f0f82f74 Mon Sep 17 00:00:00 2001
From: pedoc <pedoc@qq.com>
Date: 星期一, 29 一月 2024 18:05:17 +0800
Subject: [PATCH] 修复未配置sipdomain时出现异常

---
 src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java b/src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java
index 93d4086..e5f9fe4 100755
--- a/src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java
+++ b/src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java
@@ -89,7 +89,7 @@
      * 鏃堕棿鎴� 杞� yyyy_MM_dd
      */
     public static String timestampTo_yyyy_MM_dd(long timestamp) {
-        Instant instant = Instant.ofEpochSecond(timestamp);
+        Instant instant = Instant.ofEpochMilli(timestamp);
         return DateFormatter.format(LocalDateTime.ofInstant(instant, ZoneId.of(zoneStr)));
     }
 
@@ -139,4 +139,13 @@
         Instant beforeInstant = Instant.from(formatter.parse(keepaliveTime));
         return ChronoUnit.MILLIS.between(beforeInstant, Instant.now());
     }
+
+    public static long getDifference(String startTime, String endTime) {
+        if (ObjectUtils.isEmpty(startTime) || ObjectUtils.isEmpty(endTime)) {
+            return 0;
+        }
+        Instant startInstant = Instant.from(formatter.parse(startTime));
+        Instant endInstant = Instant.from(formatter.parse(endTime));
+        return ChronoUnit.MILLIS.between(endInstant, startInstant);
+    }
 }

--
Gitblit v1.8.0