Skip to content

Instantly share code, notes, and snippets.

@n0toose
Created November 1, 2020 07:17
Show Gist options
  • Save n0toose/b3d82f051c6f72c6146730e479639c0c to your computer and use it in GitHub Desktop.
Save n0toose/b3d82f051c6f72c6146730e479639c0c to your computer and use it in GitHub Desktop.
Leap seconds in Python
# source: https://stackoverflow.com/questions/39686553/what-does-python-return-on-the-leap-second
import time
import datetime as dt
time.mktime(time.strptime('2016-06-30T23:59:59', "%Y-%m-%dT%H:%M:%S"))
time.mktime(time.strptime('2016-06-30T23:59:60', "%Y-%m-%dT%H:%M:%S"))
# datetime will fail
dt.datetime.strptime('2016-06-30T23:59:60', "%Y-%m-%dT%H:%M:%S")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment