Bug 131108 - unexpected one-hour offset in time conversions
Summary: unexpected one-hour offset in time conversions
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: man-pages
Version: 2
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Eido Inoue
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-08-27 16:57 UTC by Eric Raymond
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-10-21 20:10:44 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Demonstrates an apparent bug in the time functions (1.14 KB, text/plain)
2004-08-27 16:59 UTC, Eric Raymond
no flags Details

Description Eric Raymond 2004-08-27 16:57:25 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510

Description of problem:
I'm not sure what is going on here.  It looks to me like one of
the time functions is stepping on the DST flag.  Run the attached 
program to see.

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

How reproducible:
Always

Steps to Reproduce:
1. Run the attached program
2. Look at the output
3. Note that the third and fourth times don't match
    

Additional info:

Comment 1 Eric Raymond 2004-08-27 16:59:02 UTC
Created attachment 103171 [details]
Demonstrates an apparent bug in the time functions

Comment 2 Jakub Jelinek 2004-08-31 11:05:10 UTC
What is unexpected there?
"The mktime() function shall convert the broken-down time, expressed as local time,"...
I've verified Solaris gives exactly the same results as Linux.

Comment 3 Roland McGrath 2004-09-09 08:18:50 UTC
This is not a bug.  The C standard specifies that mktime consults the
fields that the C standard specifies in struct tm, including tm_isdst.
The fields such as tm_zone and tm_gmtoff that give information about
what timezone to apply are extensions not specified by the C standard.
mktime cannot consult these fields, as a standard C program defining
its own struct tm might leave them as uninitialized garbage and be
correct in doing so and expecting mktime to operate on the standard
struct tm fields in the local time zone.  If your local timezone (from
TZ or /etc/localtime) has one-hour DST rules and your struct tm says
tm_isdst, then it indicates the time the standard struct tm fields
say, with the local timezone's UTC offset + 1 hour for DST.  

Comment 4 Eric Raymond 2004-09-09 10:58:45 UTC
Then I request that a WARNING be added to the mktime() manual page
explaining this situation.

Comment 5 Eido Inoue 2004-10-21 20:10:44 UTC
Don't think a warning is necessary-- man page seems pretty clear to
me, and I don't see a lot of people tripping over this.


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