DragonFly BSD
DragonFly bugs List (threaded) for 2011-03
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[issue2031] mktime and timegm are broken


From: "Alex Hornung \(via DragonFly issue tracker\)" <sinknull@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 Mar 2011 21:07:06 +0000

New submission from Alex Hornung <ahornung@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@lists.dragonflybsd.org>
<http://bugs.dragonflybsd.org/issue2031>
_____________________________________________________




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]