This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 134576 - Error: mktime() returns wrong GMT time for 2nd long hour on DST long day
Error: mktime() returns wrong GMT time for 2nd long hour on DST long day
Status: CLOSED WORKSFORME
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: glibc (Show other bugs)
3.0
ia64 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-10-04 14:57 EDT by Cindy
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-30 05:28:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Cindy 2004-10-04 14:57:54 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET 
CLR 1.0.3705; .NET CLR 1.1.4322)

Description of problem:
When mktime() is called with 2nd long hour on the daylight saving's 
long day,  it returns the GMT time the same as the first hour on the 
long day even the tm_isdst is set to 0.

Note:  for the first hour --> tim_isdst is set to 1 (mktime works OK)
       for the second hour -> tim_isdst is set to 0 (mktime retunrs
       the same GMT time as the first hour instead of 3600 seconds
       more)


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

How reproducible:
Always

Steps to Reproduce:
1.  Check your system's daya light saving long day
2.  Write test program to call mktime() with your system;s long time
3.  Pass the first hour and second long hour to mktime()
    

Actual Results:  Check the return from mktime()
both hours return the same time

Expected Results:  The second hour should be 3600 seconds more than 
the first hour

Additional info:
Comment 1 Jakub Jelinek 2004-10-12 09:19:14 EDT
$ cat /tmp/mktime.c
#include <time.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>

int main (void)
{
  struct tm tm;
  char buf[120];
  time_t t;

  setenv ("TZ", "Europe/Prague", 1);
  tzset ();
  t = 1099181079;
  tm = *localtime (&t);
  if (strftime (buf, 120, "%a,  %d  %b  %Y  %H:%M:%S  %z", &tm))
    fputs (buf, stdout);
  printf (" isdst %d == %ld\n", tm.tm_isdst, (long) mktime (&tm));
  t = 1099184679;
  tm = *localtime (&t);
  if (strftime (buf, 120, "%a,  %d  %b  %Y  %H:%M:%S  %z", &tm))
    fputs (buf, stdout);
  printf (" isdst %d == %ld\n", tm.tm_isdst, (long) mktime (&tm));
  return 0;
}

$ gcc -o /tmp/mktime{,.c}; /tmp/mktime
Sun,  31  Oct  2004  02:04:39  +0200 isdst 1 == 1099181079
Sun,  31  Oct  2004  02:04:39  +0100 isdst 0 == 1099184679
Comment 2 Jakub Jelinek 2004-10-12 09:28:27 EDT
Can you provide a testcase?  The test I posted above shows things
work as they are supposed to.
Comment 3 Jakub Jelinek 2004-10-30 05:28:30 EDT
If you have a testcase that shows some bug, please reopen.

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