time, calendar, datetime, etc

Tim Peters tim.one at comcast.net
Fri Aug 1 21:23:56 EDT 2003


[Andrew Dalke]
> ...
> Here's another view of the issue.  The datetime module implements what
> I'll call "vernacular" time.  That is, time as is understood by most
> people. 24 hours in a day, 60 minutes in an hour, 60 seconds in a
> day, 365 days in a year except every 4th year (and hazy idea about
> something strange at the century mark, but that's not a problem now).

That's what Guido calls "naive time" on the DateTimeWiki (op. cit.).  It's
the time he lives in <wink>, and datetime was deliberately designed to
mirror it.

> And then there's timezones and daylight savings time.  (And no
> thoughts of "double daylight savings like the British had during
> WWII.")

Time zones are beyond Guido's notion of naivety.  There's actually no
support for any particular time zone in 2.3's datetime module, not even UTC
or your local time zone.  Instead there's a protocol by means of which
"aware" datetime objects can be taught to play along with user-defined and
user-coded time zone classes.  Double daylight in WWII fits easily in this
framework, provided you're motivated enough to bother writing a
double-daylight tzinfo class to model it.  I hope the community cares enough
to write a collection of tzinfo classes modeling contemporary time zones,
but if they're waiting for Guido to do it for them, it ain't gonna happen.

sufficient-unto-the-day-are-the-24*3600-seconds-thereof-ly y'rs  - tim






More information about the Python-list mailing list