<p dir="ltr">There's no reason why you need to use date time objects for such extreme use cases.</p>
<p dir="ltr">--Guido van Rossum (sent from Android phone)</p>
<div class="gmail_quote">On Jun 30, 2012 10:17 AM, "Alexander Belopolsky" <<a href="mailto:alexander.belopolsky@gmail.com">alexander.belopolsky@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Sat, Jun 30, 2012 at 12:29 PM, Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br>
..<br>
> The roundtrip requirement is telling though -- they have no way to<br>
> actually represent a leap second in the underlying clock (which is a<br>
> POSIX timestamp).<br>
<br>
This correct: POSIX gettimeofday() cannot produce accurate UTC time<br>
during the leap second, but this does not mean that a python program<br>
should not be able to keep UTC time as accurately as the underlying<br>
hardware allows.  Systems synchronized with official time using NTP,<br>
get notifications about leap seconds up to a day in advance and can<br>
prepare for a second during which NTP time stops.  (As far as I<br>
understand, few systems actually stop their clocks or roll them back<br>
on a leap seconds - most slow the clocks down in various incompatible<br>
ways.)  For example, during the leap second a software clock can use<br>
clock_gettime() (or Python's new time.monotonic()) function to get<br>
actual time.<br>
<br>
For better worse, legal time throughout the world is based on UTC and<br>
once every couple of years there is a second that has to be<br>
communicated as hh:mm:60.  Today we are fortunate that it is inserted<br>
during the time when most of the world markets are closed, but next<br>
time we may see a lot of lawsuits between traders arguing over whose<br>
orders should have been filled first.  While few systems report<br>
accurate UTC time during a leap second, there is no technological<br>
limitation that would prevent most systems from implementing it.  One<br>
can even implement such UTC clock in python, but valid times produced<br>
by such clock cannot be stored in datetime objects.<br>
</blockquote></div>