On Thu, May 17, 2018 at 7:12 PM Wes Turner <wes.tur...@gmail.com> wrote:
> AstroPy solves for leap seconds [1][2] according to the IAU ERFA (SOFA) > library [3] and the IERS-B and IERS-A tables [4]. IERS-B tables ship with > AstroPy. The latest IERS-A tables ("from 1973 though one year into the > future") auto-download on first use [5]. > I've just tried it. Unfortunately, it does not seem to be compatible with PEP 495 datetime yet: >>> t = astropy.time.Time('2016-12-31T23:59:60') >>> t.to_datetime() Traceback (most recent call last): ... ValueError: Time (array(2016, dtype=int32), array(12, dtype=int32), array(31, dtype=int32), array(23, dtype=int32), array(59, dtype=int32), array(60, dtype=int32), array(0, dtype=int32)) is within a leap second but datetime does not support leap seconds Maybe someone can propose a feature for astropy to return datetime(2016,12,31,23,59,59,fold=1) in this case. > > [1] http://docs.astropy.org/en/stable/time/#time-scales-for-time-deltas > [2] http://docs.astropy.org/en/stable/time/#writing-a-custom-format > [3] "Leap second day utc2tai interpolation" > https://github.com/astropy/astropy/issues/5369 > [4] https://github.com/astropy/astropy/pull/4436 > [5] http://docs.astropy.org/en/stable/utils/iers.html > >> >>
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/