[Python-Dev] Broken strptime in Python 2.3a1 & CVS
Brett Cannon
bac@OCF.Berkeley.EDU
Sat, 11 Jan 2003 15:31:08 -0800 (PST)
OK, so I read the Open Group's specification and it had squat for default
value info (unless what they provide online is not as detailed as what
members have access to). So I logged into a Solaris machine with 2.1.1
and ran ``time.strptime('January', '%B')`` and got (1900, 1, 0, 0, 0, 0,
6, 1, 0) (which is strange because the day of the week for 1900-01-01 is
Monday, not Sunday; must be rolling back a day since the day is 0? But
then the Julian day value is wrong). But otherwise I am fine with it
defaulting to 1900-01-00 as Kevin seems to be suggesting.
But a perk of my strptime implementation is that I researched equations
that can calculate the Julian day based on the Gregorian date values,
Gregorian values based on the year and Julian day, and day of the week
from the year, month, and day. This means that if I set day to 1 if it
was not given by the user, then the Gregorian calculation will figure out
that it should be 1900-01-01; I would like to use that calculation.
Now I could special-case all of this so that this quirky business of the
day of the month being set to 0 is implemented. But I would much rather
return valid values if I am going to have to have default values in the
first place. So does anyone have any objections if I default to the date
1900-01-01 00:00:00 with a timezone of 0 and then calculate the Julian day
and day of the week? That way the default values will be valid *and* not
mess up ``time.mktime()``?
-Brett