[Numpy-discussion] dealing with datetime UTC vs linear time

Mark Dickinson mdickinson at enthought.com
Mon Jun 6 16:47:38 EDT 2011


On Mon, Jun 6, 2011 at 9:24 PM, Mark Wiebe <mwwiebe at gmail.com> wrote:

Sorry for being dense, but:

> C. Add a metadata item which chooses between "UTC" and "TAI". For seconds
> and finer, converting between UTC and TAI units is safe, and for minutes and
> coarser, is unsafe. UTC involves leap-seconds

This bit I understand, but:

> and an ambiguity-resolution in the few cases that need it,

Where does the ambiguity come from?  (Assuming we're not more than 6
months into the future.)  There would be ambiguity with POSIX time,
but doesn't UTC manage to specify any point in time unambiguously?

> [...]
> Does this design sound reasonable to people?

Python's datetime and timedelta types use POSIX time (i.e., just
pretend that leap seconds don't exist and hope that everything works
out okay).  Would this cause problems when converting between Python
and NumPy types?  I guess part of the point of this work is that with
full datetime support in NumPy the need for such conversions would be
relatively rare, so maybe there's no real problem here.

But having thought quite hard about some of these issues for Python's
datetime module recently, I'm sceptical that leap second support is
really that valuable, and fear that having it turned on by default
will cause nasty surprises for those who have no need to think about
leap seconds and write code that assumes that a minute has 60 seconds.

Mark



More information about the NumPy-Discussion mailing list