title: What does python return on the leap second
body: <p>What does python <code>time</code> and <code>datetime</code> module return on the leap second?</p>
  
  <p>What will I get when we are at <em>23:59:60.5</em> if I call:</p>
  
  <ul>
  <li><code>time.time()</code></li>
  <li><code>datetime.datetime.utcnow()</code></li>
  <li><code>datetime.datetime.now(pytz.utc)</code></li>
  </ul>
  
  <p>Also, any difference between py2.7 and py3?</p>
  
  <hr>
  
  <p>Why it is confusing (at least for me):</p>
  
  <p>From the <a href="https://docs.python.org/2/library/datetime.html" rel="noreferrer">datetime docs</a> I see:</p>
  
  <blockquote>
    <p>Unlike the time module, the datetime module does not support leap seconds.</p>
  </blockquote>
  
  <p>On the <a href="https://docs.python.org/2/library/time.html#module-time" rel="noreferrer">time docs</a> I see there is "support" for leap seconds when parsing with <code>strptime</code>. But there is no comment about <code>time.time()</code>.</p>
  
  <p>I see that using <code>time</code> I get:</p>
  
  <pre><code>&gt;&gt;&gt; time.mktime(time.strptime('2016-06-30T23:59:59', "%Y-%m-%dT%H:%M:%S"))
  1467327599.0
  &gt;&gt;&gt; time.mktime(time.strptime('2016-06-30T23:59:60', "%Y-%m-%dT%H:%M:%S"))
  1467327600.0
  &gt;&gt;&gt; time.mktime(time.strptime('2016-07-01T00:00:00', "%Y-%m-%dT%H:%M:%S"))
  1467327600.0
  </code></pre>
  
  <p>And <code>datetime</code> just blows up:</p>
  
  <pre><code>&gt;&gt;&gt; dt.datetime.strptime('2016-06-30T23:59:60', "%Y-%m-%dT%H:%M:%S")
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &amp;lt;module&gt;
  ValueError: second must be in 0..59
  </code></pre>
  
  <p>Then what will I get at that exact time (in the middle of the leap second)?</p>
  
  <p>I have read about rubber times, clocks slowing down, repeating seconds, and all kind of crazy ideas, but what should I expect on python?</p>
  
  <p>Note: In case you wonder if I don't have anything better to do that care about it, a leap second is approaching!!!!</p>