eventTime format wrong
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pycadf |
Triaged
|
High
|
Unassigned |
Bug Description
The date format of the eventTime field is not appropriate:
actual format: "eventTime": "2017-12-
expected format: "eventTime": "2017-12-
this is the part of the CADF spec. that is relevant:
6.3.4.3 Requirements
1601 This specification defines a Timestamp type that is based upon the xs:dateTime as per XMLSchema2. Any entity
1602 (or property) value that represents a Timestamp type in this specification, its extensions, or profiles SHALL adhere
1603 to the following requirements:
1604 Syntax requirements
1605 The dateTime portion of Timestamp typed values SHALL adhere to the Lexical representation as per
1606 XMLSchema2, clause 3.2.1.7 "Lexical representation".
1607 Lexical representation:
yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)
1608 The Time Zone Designator (TZD) portion of the Timestamp typed values SHALL adhere to the Lexical
1609 representation as per XMLSchema2, clause 3.2.7.3 "Timezones" and SHALL always be expressed as a UTC
1610 offset.
1611 Lexical representation:
('+' | '-') hh ':' mm
1612 The character 'Z' for Time Zone Designator (TZD) SHALL NOT be used. If a Timestamp typed value indicates
1613 an event action that actually occurred in a region where the local time UTC offset is actually zero (or 'Zulu'
1614 time), a following fully qualified TZD SHALL be used.
1615 Example:
('+' | '-') 00:00
Changed in pycadf: | |
status: | New → Triaged |
importance: | Undecided → High |
monkey patch:
def patched_ get_utc_ now(timezone= None):
"""Return the current UTC time.
:param timezone: an optional timezone param to offset time to. localize( datetime. datetime. utcnow( ))
utc_ datetime = utc_datetime. astimezone( pytz.timezone( timezone) )
_LOG. exception( 'Error translating timezones: %s ', e)
"""
utc_datetime = pytz.utc.
if timezone is not None:
try:
except Exception as e:
return utc_datetime. isoformat( )
# monkey patch pycadfs flawed timestamp formatter timestamp. get_utc_ now = patched_get_utc_now
pycadf.