[Python-checkins] CVS: python/nondist/sandbox/datetime datetime.py,1.50,1.51

M.-A. Lemburg mal@lemburg.com
Tue, 05 Mar 2002 11:42:16 +0100


Tim Peters wrote:
> 
> >> _localtzoffset():  If the given date is out of platform
> >> mktime()'s range, feed mktime() the same values except for a year
> >> that is in its range, and with the same leap-year-ness as the given
> >> year.  In effect, this imposes a "proleptic" DST determination for
> >> years outside the platform range.
> 
> [M.-A. Lemburg]
> > This fails badly.
> 
> Oh, fiddlesticks.  By construction, the platform C library knows nothing
> whatsoever about DST in such cases.  We're not trying to do substantially
> better than it can, we're just trying to return an explainable result that's
> better than random.  ECMAScript goes on to substitute a year that also
> begins with the same weekday, and I'm happy to do that too, but not more
> than that.
> 
>     The implementation of ECMAScript should not try to determine
>     whether the exact time was subject to daylight saving time, but just
>     whether daylight saving time would have been in effect if the current
>     daylight saving time algorithm had been used at the time.

My point was to not fiddle with the date at all: raise an
exception and that's it.
 
> > DST rules change every year and historic DST switch times as well as
> > future ones are not necessarily reliable.
> 
> Of course.  Ignoring reality in favor of something uniform is what
> "proleptic" means in this context, in the same way that the "proleptic
> Gregorian" calendar ignores messy date realities (about real-life
> discontinuous year numbering, varying dates of adoption across a gazillion
> principalities, leap seconds changing the lengths of days, and so on).
> 
> > Have a look at the TZ package at ftp://elsie.nci.nih.gov/pub/
> > for some fun with DST. They update those files many times a
> > year.
> 
> Actually, we figured we'd leave the 12MB-of-compressed-DST-tables market to
> eGenix <wink>.

Gee, thanks :-) I'll rather leave that market to the C lib vendors.

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/