From 2f108a46d05e34981d52b447d73f0cfd8e8c30fd Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 17 十一月 2021 16:24:31 +0800
Subject: [PATCH] Merge pull request #232 from chenparty/wvp-28181-2.0
---
src/main/java/com/genersoft/iot/vmp/gb28181/bean/WvpSipDate.java | 90 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 88 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/WvpSipDate.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/WvpSipDate.java
index ba1a1c7..f2a256b 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/WvpSipDate.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/WvpSipDate.java
@@ -1,14 +1,100 @@
package com.genersoft.iot.vmp.gb28181.bean;
+import gov.nist.core.InternalErrorHandler;
import gov.nist.javax.sip.header.SIPDate;
+
+import java.util.*;
/**
* 閲嶅啓jain sip鐨凷IPDate瑙e喅涓庡浗鏍囨椂闂存牸寮忎笉涓�鑷寸殑闂
*/
public class WvpSipDate extends SIPDate {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private Calendar javaCal;
+
public WvpSipDate(long timeMillis) {
- super(timeMillis);
+ this.javaCal = new GregorianCalendar(TimeZone.getDefault(), Locale.getDefault());
+ Date date = new Date(timeMillis);
+ this.javaCal.setTime(date);
+ this.wkday = this.javaCal.get(7);
+ switch(this.wkday) {
+ case 1:
+ this.sipWkDay = "Sun";
+ break;
+ case 2:
+ this.sipWkDay = "Mon";
+ break;
+ case 3:
+ this.sipWkDay = "Tue";
+ break;
+ case 4:
+ this.sipWkDay = "Wed";
+ break;
+ case 5:
+ this.sipWkDay = "Thu";
+ break;
+ case 6:
+ this.sipWkDay = "Fri";
+ break;
+ case 7:
+ this.sipWkDay = "Sat";
+ break;
+ default:
+ InternalErrorHandler.handleException("No date map for wkday " + this.wkday);
+ }
+
+ this.day = this.javaCal.get(5);
+ this.month = this.javaCal.get(2);
+ switch(this.month) {
+ case 0:
+ this.sipMonth = "Jan";
+ break;
+ case 1:
+ this.sipMonth = "Feb";
+ break;
+ case 2:
+ this.sipMonth = "Mar";
+ break;
+ case 3:
+ this.sipMonth = "Apr";
+ break;
+ case 4:
+ this.sipMonth = "May";
+ break;
+ case 5:
+ this.sipMonth = "Jun";
+ break;
+ case 6:
+ this.sipMonth = "Jul";
+ break;
+ case 7:
+ this.sipMonth = "Aug";
+ break;
+ case 8:
+ this.sipMonth = "Sep";
+ break;
+ case 9:
+ this.sipMonth = "Oct";
+ break;
+ case 10:
+ this.sipMonth = "Nov";
+ break;
+ case 11:
+ this.sipMonth = "Dec";
+ break;
+ default:
+ InternalErrorHandler.handleException("No date map for month " + this.month);
+ }
+
+ this.year = this.javaCal.get(1);
+ this.hour = this.javaCal.get(11);
+ this.minute = this.javaCal.get(12);
+ this.second = this.javaCal.get(13);
}
@Override
@@ -48,7 +134,7 @@
var6 = "" + this.second;
}
- int var8 = this.getJavaCal().get(14);
+ int var8 = this.javaCal.get(14);
String var7;
if (var8 < 10) {
var7 = "00" + var8;
--
Gitblit v1.8.0