[Zope3-dev] The Date Time and TimeZone question

Tim Peters tim@zope.com
Sat, 16 Mar 2002 16:54:28 -0500


[Lennart Regebro]
> There seem to be a fairly standard way on unix to find timezone
> information.

POSIX/SUS settled on the clunky old System V interface:

    http://www.opengroup.org/onlinepubs/007904975/functions/tzset.html

but it leaves much unspecified (e.g., it doesn't specify the names of
timezones, or the DST rules, etc; it does specify a framework *for*
specifying such things, though).  Note that Microsoft C also supports this
interface, although doesn't follow the POSIX rules for the format of the TZ
envar.

> There is a standard way of doing it on Windows. I assume there
> are standard ways of doing the same on Macintosh. I'm pretty sure
> all of them are incompatible. :-)

Yes, and POSIX implementations don't agree among themselves either.

> If you aren't going to use the standard tools availiable on the
> platforms you are running on, you have to implement Yet Another
> Incompatible TimeZone System, and keep track of the updates and
> changes in time zones yourself.

Someone in need of this kind of info will have to do so, yes.

> Who is going to change Python time zone database when the DST dates
> change in Elbonia?

Python doesn't have a time zone database, and the proposal doesn't change
that (yet).  Zope may have some form of time zone database, and I *expect*
will use the same one it uses today (in DateTime.py and DateTimeZone.py).
If you leave it up to the platform, then the answers you get depend on the
platform you happen to be using; transport your object across the web, and
the platform on the other end may well use different uses.  Maybe that's
what you want.  Maybe it isn't.

> This is not the first time in history the problems of time zones have
> been encountered.
>
> They have already been solved.

If by "solved" you mean someone has come up with a specific system and
claimed to have solved the problem thereby, sure, it's been solved hundreds
of times.  No such system has met with consensus approval, though, so it's
never been solved in a useful x-platform sense.  Guido isn't trying to,
either:  a tzinfo object is a hook, not an algorithm.

> I don't see why the wheel has to be reinvented unless there was
> something fundamentally flawed with all the old wheels. :-)

You can implement a tzinfo object to mimic any wheel you favor.  So all have
to do is implement a specific one, and then convince everyone else that
yours is the only choice they want too <wink>.

datetimes-are-more-of-a-social-than-a-technical-problem-ly y'rs  - tim