[Datetime-SIG] Fwd: Calendar vs timespan calculations...

Tim Peters tim.peters at gmail.com
Wed Aug 5 22:01:28 CEST 2015


[M.-A. Lemburg <mal at egenix.com>]
> I think you are mixing up a few things here, or I'm just
> misunderstanding you, which is just as possible (date/time is
> full of wonders, so no surprise there :-))
>
> If you have a local date/time value which references a day and an time
> on that day, you can convert this into UTC without caring about
> leap seconds at all. The reason is that the conversion is done
> to, again, a date and a time on that day.

I think almost everyone here does understand all this, although I
don't believe your last point was explicitly pointed out before.  It's
worth pointing out!  A time entered as YYMMDD HHMMSS can be viewed as
specifying an exact real-life UTC time, and so can (within the
limitations of the system clock) asking "what time is it now?".  For
most people, that's enough.

Leap seconds do cause the TAI and UTC Gregorian calenders to drift
more & more out of synch over time, but, as you say, those so inclined
can view each new day as starting exactly in synch with real-life UTC
again.  What they can't do with the builtin stuff is get exact
duration in SI seconds between two datetimes viewed as representing
real-life UTC.

Which Chris wants to do.  Endlessly ;-)

> ...
> Regarding terms: I started with "GMT" in mxDateTime, then
> added "UTC" as alias, and may well add "TAI" at some point as
> another alias. For most people, these are all the same, anyway :-)

Don't add TAI as an alias.  Only a relative handful of people have
ever heard of it.  Among those who both have and care about it, it has
a precisely defined meaning which isn't satisfied at all unless they
_can_ get elapsed SI seconds by subtracting.  That's a primary use
case for TAI.  The primary use case for UTC is to approximate UT1
("solar time") in a way that doesn't require changing what "a second"
means. as a duration, at every instant.

> Purists will loudly disagree, of course, but I have the Zen
> of Python to my rescue: practicality beats purity.

So long as you add "Refuse the temptation to add TAI as an alias for UTC" ;-)


More information about the Datetime-SIG mailing list