Opened 3 years ago

Closed 13 months ago

Last modified 13 months 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:


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 Changed 3 years ago by Even Rouault

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 Changed 13 months ago by Even Rouault

Resolution: fixed
Status: newclosed

In 40828:

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

comment:3 Changed 13 months ago by Even Rouault

In 40833:

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

Note: See TracTickets for help on using tickets.