Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 May 2001 11:10:18 +0900 (JST)
From:      akr@m17n.org
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/27630: mktime problem.
Message-ID:  <20010525021018.01D54727@flux.etl.go.jp>

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

>Number:         27630
>Category:       bin
>Synopsis:       mktime failure.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 24 19:20:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Tanaka Akira
>Release:        FreeBSD 4.2-RELEASE i386
>Organization:
m17n
>Environment:

FreeBSD flux 4.2-RELEASE FreeBSD 4.2-RELEASE #2: Fri Jan 12 22:55:02 JST 2001     akr@flux:/usr/src/sys/compile/AKR  i386

>Description:

mktime(3) fails on some condition.

For example, TZ=Africa/Monrovia, 1972/05/01 00:44:30 cannot be converted to
time_t.  Since this example is taken from `zdump -v Africa/Monrovia' and it
is after Epoch, there is no reason to fail.

Actually, I tested all time listed in `zdump -v' for each timezone in
/usr/share/zoneinfo and found many failures.  Above failure is one of them.

>How-To-Repeat:

% cat tst.c 
#include <stdio.h>
#include <time.h>

int main()
{
  struct tm a;
  time_t t;

  a.tm_year = 1972 - 1900;
  a.tm_mon = 5 - 1;
  a.tm_mday = 1;
  a.tm_hour = 0;
  a.tm_min = 44;
  a.tm_sec = 30;
  a.tm_wday = 0;
  a.tm_yday = 0;
  a.tm_isdst = -1;

  t = mktime(&a);
  if (t == -1) {
    perror("mktime");
    exit(1);
  }
  printf("no problem\n");
  return 0;
}
% gcc tst.c
% TZ=Africa/Monrovia ./a.out   
mktime: Undefined error: 0
% 

>Fix:

>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?20010525021018.01D54727>