Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Sep 1999 10:23:10 -0700 (PDT)
From:      duwde@elitenet.com.br
To:        freebsd-gnats-submit@freebsd.org
Subject:   misc/13862: mktime() fails (returns -1) on some dates.
Message-ID:  <19990920172310.E4E7415390@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         13862
>Category:       misc
>Synopsis:       mktime() fails (returns -1) on some dates.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 20 10:30:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Fabio Dias
>Release:        2.2.8-RELEASE (kernel 2.2.8-STABLE)
>Organization:
EliteNet ISP
>Environment:
FreeBSD cosmic.elitenet.com.br 2.2.8-STABLE FreeBSD 2.2.8-STABLE #0: Thu Sep 16 13:57:41 EST 1999     root@cosmic.elitenet.com.br:/usr/src/sys/compile/COSMIC  i386

>Description:
When using some specific dates, mktimes() is unable to return the
real time_t and returns -1.

>How-To-Repeat:
/*
   Try this, there seems to be a problem in mktime(), using 2.2.8-RELEASE.
   mktime() doesn't work when using dates like (day/month/year):
   03/10/1999 - 16/10/1994 - and others...

                                Duwde <duwde@elitenet.com.br>
*/

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

int main(int argc, char **argv)
{
time_t timet_x;
struct tm tm_x, *tm_px=&tm_x;

memset(tm_px,(int)NULL,sizeof(tm_x));
tm_px->tm_mday=3;       /* 03 */
tm_px->tm_mon=9;        /* 10 */
tm_px->tm_year=99;      /* 1999 */

if ((timet_x=mktime(tm_px)) == -1)
        {
        printf("mktime() returned -1\n");
        printf("asctime(tm_px) -> %s\n",asctime(tm_px));
        printf("ctime(&timet_x) -> %s\n",ctime(&timet_x));
        }
        else printf("everything is ok...\n");

return (int)0;

>Fix:
Fix the mktime()

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990920172310.E4E7415390>