[Numpy-discussion] Making datetime64 timezone naive

Marten van Kerkwijk m.h.vankerkwijk at gmail.com
Tue Oct 13 20:08:14 EDT 2015


>
> > However, numpy datetime is optimized for compact storage and fast
> computation of absolute deltas (actual hours, minutes, seconds... not
> calendar units like "the next day" ).
>
> Except that ironically it actually can't compute absolute deltas
> accurately with one second resolution, because it does the POSIX time thing
> of pretending that all UTC days have the same number of seconds, even
> though this is not true (leap seconds).
>
> This isn't really relevant to anything else in this thread, except as a
> reminder of how freaky date/time handling is.
>

Maybe not directly relevant, but also very clearly why one should ideally
not use these at all! Perhaps even less relevant, but if you do need
absolute times (and thus work with UTC or TAI or GPS), have a look at
astropy's `Time` class. It does use two doubles, but with that maintains
"sub-nanosecond precision over times spanning the age of the universe" [1].
And it even converts to strings nicely!

-- Marten

[1] http://docs.astropy.org/en/latest/time/index.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20151013/9a4168d2/attachment.html>


More information about the NumPy-Discussion mailing list