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

Łukasz Rekucki lrekucki at gmail.com
Sun Aug 2 19:32:58 CEST 2015

On Sunday, August 2, 2015, Alexander Belopolsky <
alexander.belopolsky at gmail.com
<javascript:_e(%7B%7D,'cvml','alexander.belopolsky at gmail.com');>> wrote:

> On Sun, Aug 2, 2015 at 9:46 AM, Guido van Rossum <guido at python.org> wrote:
> > There's a simpler reason for ignoring leap seconds in datetime: Python's
> > wall clock is mappable to POSIX timestamps, which also ignore leap
> seconds
> > (the reason being Tim's long explanation :-).
> Note that if you combine several recently made proposals, you can have
> a fully backward-compatible solution for leap seconds.

I don't have much time to respond now, but please don't add leap seconds.
People are actively working to get rid of them entirely and they are never
useful on the business level which this module is aimed at.

> You can
> simply use time(23, 59, ss, us, first=False) to stand for times in the
> 23:60 minute and delegate arithmetics to the tzinfo object:
> def __add__(self, delta):
>     try:
>         add = self.tzinfo.add
>     except AttributeError:
>         # current logic
>     else:
>         return add(self, delta)
> Same for `__sub__` and possibly `strftime`, `isoformat`, etc. if you
> want time(23, 59, ss, us, first=False) to be printed as 23:60:ss.us.
> Note that Olson database contains information about leap seconds, so
> once you have access to that and a way to spell 23:60 (as the repeated
> 23:59!) you can easily implement "correct" UTC timezone.
> On the other hand,  I would like to proceed in baby steps.  Let's
> first implement the means to disambiguate repeated times and various
> improvements that it will allow to the existing datetime
> functionality.  Meanwhile the developers of timezone libraries will
> hopefully embrace the new feature and improve their offerings.
> Hopefully, by the time we are ready to distribute a full TZ database
> with Python, the problem of distribution will be solved by IETF [1].
> If their solution (as expected) includes leap second information, we
> can find a way to give Python users access to it in one way or
> another.
> [1]: https://tools.ietf.org/html/draft-ietf-tzdist-service-11
> _______________________________________________
> Datetime-SIG mailing list
> Datetime-SIG at python.org
> https://mail.python.org/mailman/listinfo/datetime-sig
> The PSF Code of Conduct applies to this mailing list:
> https://www.python.org/psf/codeofconduct/

Łukasz Rekucki
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/datetime-sig/attachments/20150802/d39441ef/attachment.html>

More information about the Datetime-SIG mailing list