#437 mktime appears to lose an hour

WSL
closed
None
rejected
Known_bugs
2013-01-24
2003-09-25
No

Mktime appears to return a value that is 3600 too low.

gcc (GCC) 3.2.3 (mingw special 20030504-1)
runtime 3.1
Windows XP

When the following code is compiled and run:

#include <stdio.h>
#include <time.h>

int main(int argc, char **argv)
{
struct tm tms;
long time_in_secs;

tms.tm_year = 70; /* 1970 */
tms.tm_mon = 0; /* January */
tms.tm_mday = 1; /* 1st of */
tms.tm_hour = 10; /* 10 am exactly */
tms.tm_min = 0;
tms.tm_sec = 0;
tms.tm_isdst = 0;

time_in_secs = mktime(&tms);

printf("%ld\n", time_in_secs);

return 1;
}

The value output is 32400, whereas it should be 36000
(10 hours of 3600 seconds).

The machine is running in the Paris Timezone, DST set
(ie is currently at GMT + 2 hours) but mktime should
ignore this is give me the second count for the time I
have given it (10 hours after time zero). Incidentally,
if I set tm_isdst to 1, the output changes to 28800 or
8 hours rather than the 9 hours it should then report.

I have put this as runtime, but I may be wrong! Maybe I
should have put it in another category.

Discussion

  • Earnie Boyd

    Earnie Boyd - 2003-09-26

    Logged In: YES
    user_id=15438

    Not a bug we can do anything about. You'll have to report
    to Microsoft to have this fixed. Look for solutions at
    msdn.microsoft.com.

    Earnie.

     
  • Earnie Boyd

    Earnie Boyd - 2003-09-26
    • status: open --> closed-rejected
     
  • Earnie Boyd

    Earnie Boyd - 2013-01-24
    • labels: mingw runtime (deprecated use WSL) -->
    • status: closed-rejected --> closed
    • resolution: --> rejected
    • category: --> Known_bugs
    • milestone: --> WSL
     

Log in to post a comment.