[Python-Dev] Broken strptime in Python 2.3a1 & CVS
Brett Cannon
bac@OCF.Berkeley.EDU
Wed, 8 Jan 2003 16:54:31 -0800 (PST)
[Kevin Jacobs]
> No, -1 is the appropriate missing value for months, days, and years.
>
> e.g.:
> print time.strptime('12:22:23', '%H:%M:%S') # libc's strptime
> > (-1, -1, -1, 12, 22, 23, -1, -1, -1)
>
But in your example, which strptime is only given the year, month, and
day, you got (2002, 7, 1, 0, 0, 0, 0, 182, 0). Now why is the day of the
week and timezone 0 in this one but -1 in the one above?
> All of your questions about what should be returned will be answered (in
> great detail) by the various standard that define strptime. Most UNIX
> system man pages provide fairly good definitions for how strptime should
> work.
I did my implementation based on OpenBSD's strptime man page (first hit on
Google), so I have tried that already.
>It would also be wise to built a test suite that you can use to
> validate your strptime implementation against the libc strptime
> implementations (like I did for the one case that I posted). That way you
> can eventually use your strptime to detect problems in platform strptime
> implementations, though that will have to wait until your version has been
> validated to conform very strictly.
>
Could. Would be a matter of testing what time.strptime is and write a
testing function that does what is needed.
> I am very greatful for the effort you put in to your strptime implementation
> and hope that it won't be too inconvenient to go this last mile.
>
=) I am not stopping until this thing is perfect.
-Brett