<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, May 17, 2018 at 7:12 PM Wes Turner <<a href="mailto:wes.turner@gmail.com">wes.turner@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>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].</div></blockquote><div><br></div><div>I've just tried it.  Unfortunately, it does not seem to be compatible with PEP 495 datetime yet:</div><div><br></div><div>>>> t = astropy.time.Time('2016-12-31T23:59:60')</div><div>>>> t.to_datetime()</div><div>Traceback (most recent call last):</div><div> ...</div><div>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 </div><div><br></div><div>Maybe someone can propose a feature for astropy to return datetime(2016,12,31,23,59,59,fold=1) in this case.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><br></div><div>[1] <a href="http://docs.astropy.org/en/stable/time/#time-scales-for-time-deltas" target="_blank">http://docs.astropy.org/en/stable/time/#time-scales-for-time-deltas</a></div><div>[2] <a href="http://docs.astropy.org/en/stable/time/#writing-a-custom-format" target="_blank">http://docs.astropy.org/en/stable/time/#writing-a-custom-format</a></div><div>[3] "Leap second day utc2tai interpolation"</div><div><a href="https://github.com/astropy/astropy/issues/5369" target="_blank">https://github.com/astropy/astropy/issues/5369</a></div><div>[4] <a href="https://github.com/astropy/astropy/pull/4436" target="_blank">https://github.com/astropy/astropy/pull/4436</a></div><div>[5] <a href="http://docs.astropy.org/en/stable/utils/iers.html" target="_blank">http://docs.astropy.org/en/stable/utils/iers.html</a></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
</blockquote>
</blockquote></div></div>