New submission from Alex Hornung <[email protected]>:

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 <[email protected]>
<http://bugs.dragonflybsd.org/issue2031>
_____________________________________________________

Reply via email to