pytz has so many timezones!

Nicholas Bastin nick.bastin at gmail.com
Tue Oct 9 02:59:41 EDT 2007


On 10/9/07, mensanator at aol.com <mensanator at aol.com> wrote:
> On Oct 8, 8:27?pm, "Nicholas Bastin" <nick.bas... at gmail.com> wrote:
> > On 10/8/07, mensana... at aol.com <mensana... at aol.com> wrote:
> > > Because they publish maps?
> >
> > I'm not sure what this has to do with it.
>
> Maybe you've never had to navigate?

I don't often find the need to navigate by time zone.  Nor do
cartographers consider themselves experts on time, but rather
geography.

> WHY must we accomodate the ignorant? Why not cut them off
> from the Internet until they get their act together? Don't
> people get mad at Microsoft for breaking standards? People like
> you are to blame for accomodating broken standards. "Oh, no,
> we can't afford to lose those three potential customers who
> live on an island in Kiribati!"

There's no broken standard here.  I'd advise you to refrain from
painting other people with your own ignorant brush.

> > 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.
>
> Isn't that what they call a "locale"?

No.  If we spoke a different language or used a different script,
that'd be a different locale.  Of course, we might still be in the
same time zone.

> > > > 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,
>
> And you start that education by learning the 25 timezones.
> Then when you understand that, you can then learn about locales.

Just because NATO thinks there's 25 time zones doesn't mean that
they're any more correct than all of the local entities which have
defined their own time zones.   And again, your usage of the word
'locale' bears no relationship to the actual definition, in computer
science terms.

> > 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.
>
> It helps to know what you're drifting from.

You're drifting from UTC.  UTC which has no bearing nor controlling
influence on time zone definitions.  Just because government entities
reference +/- UTC in time zone definitions does not mean that they're
substantially related.

> > At the very least your algorithm needs to be greedy.
>
> How good an algorithm do you think the OP will come up
> with if he doesn't understand why his list has 400 items
> or has any clue how to reduce it?

I didn't presume the OP was an idiot.  I felt that it was much more
reasonable to explain how the 400 differed then to paint for him a
fairy tale of 25 magical time zones, which had no bearing on his
application.  There are many ways to filter the 400 based on the needs
of each application, and I leave it as an exercise to the OP to either
deduce the appropriate ones, or ask more questions.

> > > 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,
>
> Locales.

No, locale has already been defined by the computer science community,
and it doesn't involve time zones.  There are, realistically, less
than 400 locales.  Do not confuse the two.  (Locales can be consistent
across many time zones - see en_US for a trivial example).  Locales
are coded by language, script, country, and a variant, and do not
contain time zone information.

> > 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.
>
> So, you can live your life with functional definations,
> never bothering to learn any theory? Is code monkey all you
> aspire to?

Well, I certainly don't aspire to be a stuck up ass, which is
apparently what you've been working towards.

There is no magical theory behind time zones.  There is no one truth,
and there is no controlling global regulation.  Does NATO have a
simple time zone implementation?  Absolutely.  Is that relevant to
most consumer applications?  Absolutely not.

When you write applications for the military, feel free to adhere to
their standards.  When you write applications for an international
community, you might want to put the bigotry aside and cater to their
actual needs.

--
Nick



More information about the Python-list mailing list