修正时间戳转Date 时区问题

This commit is contained in:
shikong 2023-09-18 11:01:26 +08:00
parent 55959ace86
commit ea8f0500d6

View File

@ -1,6 +1,7 @@
package cn.skcks.docking.gb28181.mocking.core.sip.message.processor.invite.request;
import cn.hutool.core.date.DateUtil;
import cn.skcks.docking.gb28181.core.sip.gb28181.constant.GB28181Constant;
import cn.skcks.docking.gb28181.core.sip.gb28181.sdp.GB28181Description;
import cn.skcks.docking.gb28181.core.sip.gb28181.sdp.MediaSdpHelper;
import cn.skcks.docking.gb28181.core.sip.listener.SipListener;
@ -31,6 +32,7 @@ import javax.sdp.*;
import javax.sip.RequestEvent;
import javax.sip.message.Request;
import javax.sip.message.Response;
import java.time.ZoneId;
import java.util.Arrays;
import java.util.Date;
import java.util.EventObject;
@ -166,8 +168,8 @@ public class InviteRequestProcessor implements MessageProcessor {
@SneakyThrows
private void playback(SIPRequest request, MockingDevice device, GB28181Description gb28181Description, MediaDescription mediaDescription, TimeField time, boolean isDownload) {
Date start = new Date(time.getStartTime() * 1000);
Date stop = new Date(time.getStopTime() * 1000);
Date start = DateUtil.convertTimeZone(new Date(time.getStartTime() * 1000), ZoneId.of(GB28181Constant.TIME_ZONE));
Date stop = DateUtil.convertTimeZone(new Date(time.getStopTime() * 1000), ZoneId.of(GB28181Constant.TIME_ZONE));
log.info("{} ~ {}", start, stop);
String channelId = gb28181Description.getOrigin().getUsername();
log.info("通道id: {}", channelId);