Opened 8 years ago

Closed 6 years ago

Last modified 6 years ago

#6525 closed defect (fixed)

OGRParseDate accepts 61 seconds

Reported by: Ari Jolma Owned by: warmerdam
Priority: low Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

According to wikipedia article on ISO 8601 accepts 60 seconds in a date to denote leap seconds. However, OGRParseDate accepts 61 seconds.

Additionally, shouldn't OGRParseDate set an error state with CPLError if the provided timestamp is not ok?

Change History (3)

comment:1 by Even Rouault, 8 years ago

You're probably right about the test > 61 that should be changed to >= 61 or > 60 (not sure why, but I think I read somewhere that there could potential have 2 leap seconds, but cannot find any evidence of that).

Regarding emitting CPLError(), I'm not sure as OGRParseDate() is used in various places, such as in the CSV or GeoJSON driver to guess if a string field is a generic field or a datetime fields. In those use cases, we don't want an error to be emitted.

comment:2 by Even Rouault, 6 years ago

Resolution: fixed
Status: newclosed

In 40828:

OGRParseDate(): only accept seconds up to 60 included for leap seconds (fixes #6525)

comment:3 by Even Rouault, 6 years ago

In 40833:

test_ogr: improve tests of OGRPaseData() regarding leap second (refs #6525)

Note: See TracTickets for help on using tickets.