[gdal-dev] Odd date conversion from geojson file in OGR - rounding up to invalid value
Even Rouault
even.rouault at spatialys.com
Thu Jun 26 16:05:52 PDT 2025
Le 27/06/2025 à 00:58, Andrew C Aitchison via gdal-dev a écrit :
> On Thu, 26 Jun 2025, Smith, Michael ERDC-RDE-CRREL-NH CIV via gdal-dev
> wrote:
>
>> I have a geojson file that has a date field that is:
>> "AOI_TASKING_DATE_END": "2025-11-30T23:59:59.999999Z",
>>
>> Gdal vector info is reporting this as:
>> AOI_TASKING_DATE_END (DateTime) = 2025/11/30 23:59:60+00
>>
>> Is this a gdal bug that is rounding the date up to an invalid value?
>> Is there a way to control this?
>
> I believe that there is an agreement to discontinue leap-seconds by 2035,
> but the last second of any month *can* be 23:59:60 UTC !
> (In practice all leap seconds so far have been June or December)
yeah, GDAL (at least that part) should handle leap seconds. The fix I
did was just to round 59.999xxxx to 59.999 instead of 60.0, as the
59.999xxx is a clear indication of "whatever value is just before
midnight". If the value of seconds is 60.something, this tweak will not
trigger (someone nitpicking will probably notice that 60.999999 will be
rounded as 61.000000. Let as an exercice for contributers to address
that extreme unlikely use case :-))
--
http://www.spatialys.com
My software is free, but my time generally not.
More information about the gdal-dev
mailing list