[Python-ideas] High Precision datetime

Rob Speer rspeer at luminoso.com
Tue May 15 14:21:46 EDT 2018


On Mon, 14 May 2018 at 12:17 Chris Angelico <rosuav at gmail.com> wrote:

> On Tue, May 15, 2018 at 2:05 AM, Chris Barker via Python-ideas
> <python-ideas at python.org> wrote:
> > But my question is whether high precision timedeltas belongs with
> "calendar
> > time" at all.
> >
> > What with UTC and leap seconds, and all that, it gets pretty ugly, when
> down
> > to the second or sub-second, what a given datetime really means.
>
> UTC and leap seconds aren't a problem. When there's a leap second, you
> have 23:59:60 (or you repeat 23:59:59, if you can't handle second
> #60). That's pretty straight-forward, perfectly well-defined.
>

I'm sure that the issue of "what do you call the leap second itself" is not
the problem that Chris Barker is referring to. The problem with leap
seconds is that they create unpredictable differences between UTC and real
elapsed time.

You can represent a timedelta of exactly 10^8 seconds, but if you add it to
the current time, what should you get? What UTC time will it be in 10^8
real-time seconds? You don't know, and neither does anybody else, because
you don't know how many leap seconds will occur in that time.

The ways to resolve this problem are:
(1) fudge the definition of "exactly 10^8 seconds" to disregard any leap
seconds that occur in that time interval in the real world, making it not
so exact anymore
(2) use TAI instead of UTC, as GPS systems do
(3) leave the relationship between time deltas and calendar time undefined,
as some in this thread are suggesting
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180515/f8334fc5/attachment-0001.html>


More information about the Python-ideas mailing list