[Python-ideas] Happy leap second

Alexander Belopolsky alexander.belopolsky at gmail.com
Sat Jun 30 17:18:07 CEST 2012

On Sat, Jun 30, 2012 at 10:57 AM, Guido van Rossum <guido at python.org> wrote:
> POSIX timestamps don't have leap seconds. Convince POSIX to change
> that and Python will follow suit.

POSIX (time_t) timestamps are mostly irrelevant for the users of the
datetime module.  POSIX type that is closest to datetime.datetime is
struct tm and it does have leap seconds:

The <time.h> header shall declare the structure tm, which shall
include at least the following members:

int    tm_sec   Seconds [0,60].
"""  - http://pubs.opengroup.org/onlinepubs/009696699/basedefs/time.h.html

Note that that POSIX does require that a round-trip through time_t
(localtime(mktime(x))) converts hh:59:60 to (hh+1):00:00, but
datetime.timestamp() can still do the same if we make second=60 valid.

More information about the Python-ideas mailing list