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

Bug#444597: marked as done (mktime returns 0x7fffffff for the year 2057)



Your message dated Sun, 30 Sep 2007 12:09:07 +0200
with message-id <87y7eo79do.fsf@mid.deneb.enyo.de>
and subject line Bug#444597: mktime returns 0x7fffffff for the year 2057
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: libc6
Version: 2.3.6.ds1-13etch2

mktime returns 0x7fffffff for the year 2057.

I expect it fails on 32-bit time_t environment.

% cat t.c
#include <stdlib.h>
#include <stdio.h>
#include <time.h>

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

  printf("sizeof(time_t): %d\n", sizeof(time_t));
  printf("sizeof(long): %d\n", sizeof(long));

  tm.tm_sec = 0;
  tm.tm_min = 59;
  tm.tm_hour = 23;
  tm.tm_mday = 31;
  tm.tm_mon = 12 - 1;
  tm.tm_year = 2057 - 1900;
  tm.tm_isdst = -1;

  t = mktime(&tm);
  if (t == (time_t)(-1)) { printf("mktime failed\n"); exit(1); }

  printf("result: %ld (%lx)\n", t, t);
  printf("isdst: %d\n", tm.tm_isdst);
  return 0;
}
% gcc -Wall t.c
% ./a.out               
sizeof(time_t): 4
sizeof(long): 4
result: 2147483647 (7fffffff)
isdst: 0
% uname -a
Linux nute 2.6.18-5-686 #1 SMP Thu Aug 30 02:19:07 UTC 2007 i686 GNU/Linux
% dpkg -l|grep libc6
ii  libc6                            2.3.6.ds1-13etch2                   GNU C Library: Shared libraries
ii  libc6-dev                        2.3.6.ds1-13etch2                   GNU C Library: Development Libraries and Hea
ii  libc6-i686                       2.3.6.ds1-13etch2                   GNU C Library: Shared libraries [i686 optimi
-- 
Tanaka Akira



--- End Message ---
--- Begin Message ---
* Tanaka Akira:

> Package: libc6
> Version: 2.3.6.ds1-13etch2
>
> mktime returns 0x7fffffff for the year 2057.

This is the expected behavior:

RETURN VALUE
       Each of these functions returns the value described,  or  NULL  (-1  in
       case of mktime()) in case an error was detected.

(POSIX agrees with that.)


--- End Message ---

Reply to: