eventTime format wrong

Bug #1738737 reported by jobrs
8
This bug affects 1 person
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-11T13:36:01.263944+0000"

expected format: "eventTime": "2017-12-11T13:36:01.263944+00:00"

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

Revision history for this message
jobrs (joachim-barheine) wrote :

monkey patch:

def patched_get_utc_now(timezone=None):
    """Return the current UTC time.

    :param timezone: an optional timezone param to offset time to.
    """
    utc_datetime = pytz.utc.localize(datetime.datetime.utcnow())
    if timezone is not None:
        try:
            utc_datetime = utc_datetime.astimezone(pytz.timezone(timezone))
        except Exception as e:
            _LOG.exception('Error translating timezones: %s ', e)

    return utc_datetime.isoformat()

# monkey patch pycadfs flawed timestamp formatter
pycadf.timestamp.get_utc_now = patched_get_utc_now

Changed in pycadf:
status: New → Triaged
importance: Undecided → High
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.