PyConDE 2018: "A Day Has Only 24+-1 Hours. import pytz" by Miroslav Šedivý


Do not check datetime too often!

Use time.monotonic even if your expensive operation takes long time!

Timezones all over the world in one look

Timezones within years

Best practices

  • don't invent your own timezone
  • don't hard code any rules
  • keep your libs up-to-date
  • convert from local time to UTC as soon as possible (be precise or guess)
  • convert from UTC to local time as late as possible
  • follow your government's intentions to modify your time zone and inform tz@iana.org
  • avoid timezones if you can!