Bug 88275

Summary: strptime sets tm_isdst incorrectly
Product: [Retired] Red Hat Linux Reporter: Michael Stenner <mstenner>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 9CC: drepper, fweimer, roland
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-04-08 20:03:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Description Flags
test program to demonstrate bug none

Description Michael Stenner 2003-04-08 15:11:20 UTC
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 15:13:53 UTC
Created attachment 91009 [details]
test program to demonstrate bug

Comment 2 Jakub Jelinek 2003-04-08 20:03:34 UTC
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).