This commit is contained in:
shikong 2023-08-18 16:32:36 +08:00
parent 2f92fc6a86
commit f4e532a7ec

View File

@ -1,5 +1,8 @@
package cn.skcks.docking.gb28181.test;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.date.ZoneUtil;
import cn.skcks.docking.gb28181.common.json.JsonResponse;
import cn.skcks.docking.gb28181.media.config.ZlmMediaConfig;
import cn.skcks.docking.gb28181.media.dto.config.ServerConfig;
@ -14,7 +17,11 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.util.List;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.*;
@Slf4j
@SpringBootTest
@ -36,4 +43,18 @@ public class MediaServiceTest {
JsonResponse<List<ServerConfig>> test = zlMediaHttpService.getServerConfig(secret);
log.info("{}", test);
}
@Test
void test(){
long unix = 1692346604L;
Instant instant = Instant.ofEpochSecond(unix);
log.info("{}", LocalDateTime.ofEpochSecond(unix, 0, TimeZone.getTimeZone("UTC").toZoneId().getRules().getOffset(instant)));
log.info("{}", LocalDateTimeUtil.of(instant, TimeZone.getTimeZone("UTC")));
log.info("{}", LocalDateTime.ofEpochSecond(unix, 0, ZoneOffset.ofHours(0)));
log.info("{}", LocalDateTime.ofEpochSecond(unix, 0, TimeZone.getTimeZone("Asia/Shanghai").toZoneId().getRules().getOffset(instant)));
log.info("{}", LocalDateTimeUtil.of(instant, TimeZone.getTimeZone("GMT+8")));
log.info("{}", LocalDateTime.ofEpochSecond(unix, 0, ZoneOffset.ofHours(8)));
}
}