Omaha #4486 - Add python serialized FormattedDate
Change-Id: I2b780b7bc705bd678e06580ef46ac98f6143f661 Former-commit-id: 83848a04748bb41249eb1edd47d87a5ea92ab3f8
This commit is contained in:
parent
cf84ca32a2
commit
1798e4f57f
4 changed files with 90 additions and 2 deletions
|
@ -0,0 +1,46 @@
|
|||
##
|
||||
# This software was developed and / or modified by Raytheon Company,
|
||||
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
#
|
||||
# U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
# This software product contains export-restricted data whose
|
||||
# export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
# to non-U.S. persons whether in the United States or abroad requires
|
||||
# an export license or other authorization.
|
||||
#
|
||||
# Contractor Name: Raytheon Company
|
||||
# Contractor Address: 6825 Pine Street, Suite 340
|
||||
# Mail Stop B8
|
||||
# Omaha, NE 68106
|
||||
# 402.291.0100
|
||||
#
|
||||
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
# further licensing information.
|
||||
##
|
||||
|
||||
|
||||
#
|
||||
# Adapter for FormattedDate
|
||||
#
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 9/21/2015 4486 rjpeter Initial creation.
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.time import FormattedDate
|
||||
|
||||
|
||||
ClassAdapter = 'com.raytheon.uf.common.time.FormattedDate'
|
||||
|
||||
def serialize(context, date):
|
||||
context.writeI64(date.getTime())
|
||||
|
||||
def deserialize(context):
|
||||
result = FormattedDate()
|
||||
result.setTime(context.readI64())
|
||||
return result
|
|
@ -32,7 +32,7 @@
|
|||
# 04/22/13 #1949 rjpeter Added LockTableAdapter
|
||||
# 02/06/14 #2672 bsteffen Added JTSEnvelopeAdapter
|
||||
# 06/22/2015 #4573 randerso Added JobProgressAdapter
|
||||
#
|
||||
# 09/21/2015 #4486 rjpeter Added FormattedDateAdapter
|
||||
#
|
||||
|
||||
__all__ = [
|
||||
|
@ -43,6 +43,7 @@ __all__ = [
|
|||
'GregorianCalendarAdapter',
|
||||
'ActiveTableModeAdapter',
|
||||
'DateAdapter',
|
||||
'FormattedDateAdapter',
|
||||
'LocalizationLevelSerializationAdapter',
|
||||
'LocalizationTypeSerializationAdapter',
|
||||
'GeometryTypeAdapter',
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
##
|
||||
# This software was developed and / or modified by Raytheon Company,
|
||||
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
#
|
||||
# U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
# This software product contains export-restricted data whose
|
||||
# export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
# to non-U.S. persons whether in the United States or abroad requires
|
||||
# an export license or other authorization.
|
||||
#
|
||||
# Contractor Name: Raytheon Company
|
||||
# Contractor Address: 6825 Pine Street, Suite 340
|
||||
# Mail Stop B8
|
||||
# Omaha, NE 68106
|
||||
# 402.291.0100
|
||||
#
|
||||
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
# further licensing information.
|
||||
##
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 09/21/2015 4486 rjpeter Initial creation.
|
||||
#
|
||||
##
|
||||
|
||||
from time import gmtime, strftime
|
||||
from dynamicserialize.dstypes.java.util import Date
|
||||
|
||||
class FormattedDate(Date):
|
||||
|
||||
def __init__(self, timeInMillis=None):
|
||||
super(FormattedDate, self).__init__(timeInMillis)
|
||||
|
||||
def __repr__(self):
|
||||
return strftime("%Y-%m-%d %H:%M:%S.", gmtime(self.time/1000.0)) + '{:03d}'.format(self.time%1000)
|
|
@ -22,9 +22,11 @@
|
|||
|
||||
__all__ = [
|
||||
'DataTime',
|
||||
'TimeRange'
|
||||
'TimeRange',
|
||||
'FormattedDate'
|
||||
]
|
||||
|
||||
from DataTime import DataTime
|
||||
from TimeRange import TimeRange
|
||||
from FormattedDate import FormattedDate
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue