pytz has so many timezones!

Nicholas Bastin nick.bastin at gmail.com
Mon Oct 8 21:27:09 EDT 2007


On 10/8/07, mensanator at aol.com <mensanator at aol.com> wrote:
> > What do you mean by "the military" and why do you think they're
> > authoritative on the topic of timezones?
>
> Because they publish maps?

I'm not sure what this has to do with it.

> > but as far as I know they don't define timezones.
>
> Ok, maybe they don't define them. But they get them from somewhere
> and the zones are labeled A-Z (don't ask which letter isn't used).
> Zone Z is equivalent to GMT and the time is refered to as Zulu time.

They get them from NATO.  NGO's outside of NATO do not use NATO time
zones for describing time data, mostly because NATO doesn't care about
daylight savings time.  Works fine for the military, but not so well
for your civilian users.

> That's 25 zones, not 400. Under that system there are no half-hour
> offset zones, no zones based on sunset and no lunatic GMT+13 zones.

Yes, but lucky for us, we live in the real world, so we have to deal
with 400 time zones.  The reality is that people LIVE in those
'lunatic' time zones, and software needs to address that.

If I schedule a meeting with someone in Indiana, and I'm in Ohio,
they're in the same military time zone, but they don't observe
daylight savings time, so in fact our times are different.  Users
probably want our applications to handle these problems.

> > Since timezones (obviously)
> > contain more information than just the GMT offset
>
> Of course. But the GMT offset could be used to filter his list
> of 400 choices, couldn't it?

Sortof.  First, your user has to understand what GMT is, so that's
already going to cause problems.   Secondly, you need to handle time
zones which drift from different GMT offsets depending on the time of
year.  At the very least your algorithm needs to be greedy.

> Agreed. But if someone gave me a list of 400 choices, I would look
> for some way to reduce the list to a manageable choice. Isn't that
> what the OP wants?
>
> Why not teach him the truth, starting from the top level? Shouldn't
> you teach him to fish rather than just give him one?

Because the truth is that there are upwards of 400 different time
zones, accounting for local custom and law.  The military can
conveniently ignore that, but we as application writers cannot.

There is no central authority which defines global time zones.  The
functional definition of a time zone is merely a geographical area of
the earth that has adopted the same local time rules.

--
Nick



More information about the Python-list mailing list