Bug 88275 - strptime sets tm_isdst incorrectly
strptime sets tm_isdst incorrectly
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2003-04-08 11:11 EDT by Michael Stenner
Modified: 2007-04-18 12:52 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-04-08 16:03:34 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
test program to demonstrate bug (489 bytes, text/plain)
2003-04-08 11:13 EDT, Michael Stenner
no flags Details

  None (edit)
Description Michael Stenner 2003-04-08 11:11:20 EDT
Description of problem:
strptime sets tm_isdst incorrectly.  Ths was first noticed because python (all
versions) use glibc's strptime.

Version-Release number of selected component (if applicable):

glibc-2.2.5-43 through glibc-2.3.2-11.9  at least
this corresponds to the versions on RHL 7.3 through RHL 9

How reproducible:
Completely.  See attached sample program.  I recognize that it may depend
on the locale and would be happy to provide whatever info you need.  I'm
just not sure at this point what that woud be.  I'm in eastern time just
like you, btw.

Steps to Reproduce:
1. compile program using strptime
2. run it
3. look at results :)
Actual results:
in ALL of my tests (whether the string time was in DST or not) tm_isdst was
set to 1108544020

Expected results:
well, it should be -1, 0, or 1 according to /usr/include/time.h

Additional info:
attaching sample program
Comment 1 Michael Stenner 2003-04-08 11:13:53 EDT
Created attachment 91009 [details]
test program to demonstrate bug
Comment 2 Jakub Jelinek 2003-04-08 16:03:34 EDT
From my reading of http://www.opengroup.org/onlinepubs/007908799/xsh/strptime.html
it seems that strptime is required to only set the fields mentioned in the format
(and recompute tm_wday and tm_yday if day/month/year changed) and the rest
is unspecified whether it is preserved from previous content of the structure
or newly set by strptime (and there is no way how can strptime guess this
value even, there is no %Z format specifier for strptime).

Note You need to log in before you can comment on or make changes to this bug.