[issue2031] mktime and timegm are broken

Alex Hornung (via DragonFly issue tracker) sinknull at leaf.dragonflybsd.org
Mon Mar 21 14:08:35 PDT 2011


New submission from Alex Hornung <ahornung at gmail.com>:

Both mktime and timegm are broken. They seem to always return -1 while any other 
system with the same code returns the correct result.

This must have been broken for years, since no recent changes look suspicious.

Test case:

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

int main(void) {
        struct tm tm;
        time_t gm_time;

        memset(&tm, 0, sizeof(struct tm));
        tm.tm_sec = 20;
        tm.tm_min = 1;
        tm.tm_hour = 3;
        tm.tm_mday = 15;
        tm.tm_mon = 12;
        tm.tm_year = 2010;


        gm_time = mktime(&tm);
        printf("Time is: %d\n", gm_time);
        return 0;
}

----------
messages: 9747
nosy: alexh
priority: urgent
status: unread
title: mktime and timegm are broken

_____________________________________________________
DragonFly issue tracker <bugs at lists.dragonflybsd.org>
<http://bugs.dragonflybsd.org/issue2031>
_____________________________________________________






More information about the Bugs mailing list