6

OK, this is more a curiosity question, but how does pytz know all the daylight savings times (DST)? For example, that 'Europe/Copenhagen' time switches in March and October.

Or rather, what happens if a country decides to do away with DST? Will everyone have to get an updated version of Pytz? Is there someone "at pytz" keeping track of this? Is there a formal list somewhere?

user984003
  • 28,050
  • 64
  • 189
  • 285

2 Answers2

4

PyTZ uses the Olson timezone database, and it updates regularly. PyTZ is not the only user; most POSIX systems use it too, including Linux and OS X.

Yes, new revisions of PyTZ are packaged whenever that database updates.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • And then we need to remember to update our pytz versions. There must be some outdated code out there.. – user984003 Nov 12 '12 at 16:17
  • @user984003: You could install `pytz` with `pip` or `easy_install`, then run a cronjob with `pip install -U pytz` or `easy_install --upgrade pytz` once in a while to automatically upgrade to the latest version. – Martijn Pieters Nov 12 '12 at 16:57
1

From the "Latest Versions" section of the pytz documentation:

This package will be updated after releases of the Olson timezone database.

So the answers to your questions appear to be yes, an update will be released if the tz database is updated, and you will need to update your installation of pytz.

David Alber
  • 17,624
  • 6
  • 65
  • 71