Bug 131108 - unexpected one-hour offset in time conversions
unexpected one-hour offset in time conversions
Product: Fedora
Classification: Fedora
Component: man-pages (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Eido Inoue
Ben Levenson
Depends On:
  Show dependency treegraph
Reported: 2004-08-27 12:57 EDT by Eric Raymond
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-21 16:10:44 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

  None (edit)
Description Eric Raymond 2004-08-27 12:57:25 EDT
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):

How reproducible:

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 12:59:02 EDT
Created attachment 103171 [details]
Demonstrates an apparent bug in the time functions
Comment 2 Jakub Jelinek 2004-08-31 07:05:10 EDT
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 04:18:50 EDT
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 06:58:45 EDT
Then I request that a WARNING be added to the mktime() manual page
explaining this situation.
Comment 5 Eido Inoue 2004-10-21 16:10:44 EDT
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.