old mode 100644
new mode 100755
|  |  |  | 
|---|
|  |  |  | package com.genersoft.iot.vmp.utils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import org.apache.commons.lang3.ObjectUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.time.Instant; | 
|---|
|  |  |  | import java.time.LocalDate; | 
|---|
|  |  |  | import java.time.LocalDateTime; | 
|---|
|  |  |  | import java.time.ZoneId; | 
|---|
|  |  |  | import java.time.format.DateTimeFormatter; | 
|---|
|  |  |  | import java.time.format.DateTimeParseException; | 
|---|
|  |  |  | import java.time.temporal.ChronoUnit; | 
|---|
|  |  |  | import java.time.temporal.TemporalAccessor; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Locale; | 
|---|
|  |  |  | 
|---|
|  |  |  | LocalDateTime nowDateTime = LocalDateTime.now(); | 
|---|
|  |  |  | return formatterISO8601.format(nowDateTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static long getDifferenceForNow(String keepaliveTime) { | 
|---|
|  |  |  | if (ObjectUtils.isEmpty(keepaliveTime)) { | 
|---|
|  |  |  | return 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Instant beforeInstant = Instant.from(formatter.parse(keepaliveTime)); | 
|---|
|  |  |  | return ChronoUnit.MILLIS.between(beforeInstant, Instant.now()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|