[Python-Dev] Broken strptime in Python 2.3a1 & CVS (original) (raw)
Kevin Jacobs jacobs@penguin.theopalgroup.com
Wed, 8 Jan 2003 19:05:14 -0500 (EST)
- Previous message: [Python-Dev] Broken strptime in Python 2.3a1 & CVS
- Next message: [Python-Dev] Broken strptime in Python 2.3a1 & CVS
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 8 Jan 2003, Brett Cannon wrote:
[Kevin Jacobs]
> Hi all, > > I've just noticed a problem in one of our financial systems that was caused > by the new pure-Python strptime module by Brett Cannon. Lucky me. =) > Python 2.3-cvs (with #undef HAVESTRPTIME hard-coded): Just for future reference, you can just import
strptime
and usestrptime.strptime()
instead of having to fiddle withtime
.
I just removed the #undef HAVE_STRPTIME in the mean time. Thanks for the tip, though. ;)
OK, so I will take a look, but if anyone beats me to a solution I will have no qualms about it. =)
I suspect that I know the cause, though I have not looked at the source for the specific code. Basically, your strptime implementation leaves unspecified information as -1. This is nice, except that it violates the SVID 3, POSIX, BSD 4.3, ISO 9899 standards. i.e., here is an exerpt from the mktime man page on my linux system on how the values in a time-tuple are interpreted:
The mktime() function converts a broken-down time structure, expressed
as local time, to calendar time representation. The function ignores
the specified contents of the structure members tm_wday and tm_yday and
recomputes them from the other information in the broken-down time
structure. If structure members are outside their legal interval, they
will be normalized (so that, e.g., 40 October is changed into 9 Novem-
ber).
Thus, mktime correctly returns a time-from-epoch that is 1 hour, 1 minute, and 1 second (3661 seconds) behind where it should be (unless it is DST).
Thanks for the quick reply, -Kevin
-- Kevin Jacobs The OPAL Group - Enterprise Systems Architect Voice: (216) 986-0710 x 19 E-mail: jacobs@theopalgroup.com Fax: (216) 986-0714 WWW: http://www.theopalgroup.com
- Previous message: [Python-Dev] Broken strptime in Python 2.3a1 & CVS
- Next message: [Python-Dev] Broken strptime in Python 2.3a1 & CVS
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]