Bug 88275 - strptime sets tm_isdst incorrectly
Summary: strptime sets tm_isdst incorrectly
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc
Version: 9
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2003-04-08 15:11 UTC by Michael Stenner
Modified: 2016-11-24 15:14 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2003-04-08 20:03:34 UTC

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

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).

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