Y2K compliance of mktime

Y2K compliance of mktime

Post by Markus Enzenberg » Wed, 07 Apr 1999 04:00:00



Hi,

I have a problem when using the mktime function of glibc 2.0.
It does not accept tm.tm_year > 99 as an argument (returns -1).
The documentation says that tm.tm_year is the number of years
since 1900.

Could this be a problem for some applications after 2000?

- Markus

 
 
 

Y2K compliance of mktime

Post by Andreas Jaege » Wed, 07 Apr 1999 04:00:00


Quote:>>>>> Markus Enzenberger writes:

 > Hi,
 > I have a problem when using the mktime function of glibc 2.0.
 > It does not accept tm.tm_year > 99 as an argument (returns -1).
 > The documentation says that tm.tm_year is the number of years
 > since 1900.

Please send me privatly (or use the glibcbug script) a short program
that shows the problem.  Looking at the code of glibc 2.0.7preX, I
don't see direclty this behaviour.  I guess, you've got some kind of
error in your program but need to look at the code first before making
any final comments.

 > Could this be a problem for some applications after 2000?
If you're right.

Andreas
--



 
 
 

1. Is mktime Y2K Broken?

It appears that mktime is freaking out with some of my code as of
midnight last night.

Anybody else seen this behaviour?

Here is a debug run showing what's happening:

/* simple test mktime.c */
main(int argc, char **argv)
{

time_t ftime,ttime;
static struct tm test;

test.tm_year=99;
test.tm_mon=12;
test.tm_mday=30;
test.tm_hour=23;
test.tm_sec=0;
test.tm_min=0;
test.tm_isdst=-1;

ftime = mktime(&test);

(gdb) break main
Breakpoint 1 at 0x80483ee: file mktime.c, line 36.
(gdb) run
Starting program: /home/rick/mktime

Breakpoint 1, main (argc=1, argv=0xefbfdab8) at mktime.c:36
36      test.tm_year=99;
(gdb) n
37      test.tm_mon=12;
(gdb)
38      test.tm_mday=30;
(gdb)
39      test.tm_hour=23;
(gdb)
40      test.tm_sec=0;
(gdb)
41      test.tm_min=0;
(gdb)
42      test.tm_isdst=-1;
(gdb)
44      ftime = mktime(&test);
(gdb) p test
$1 = {tm_sec = 0, tm_min = 0, tm_hour = 23, tm_mday = 30, tm_mon = 12,
  tm_year = 99, tm_wday = 0, tm_yday = 0, tm_isdst = -1, tm_gmtoff = 0,
  tm_zone = 0x0}

The test struct above looks quite sane to me prior to the call to
mktime.

(gdb) n
46      }
(gdb) p test
$2 = {tm_sec = 0, tm_min = 0, tm_hour = 23, tm_mday = 30, tm_mon = 0,
  tm_year = 100, tm_wday = 0, tm_yday = 29, tm_isdst = 0, tm_gmtoff =
-18000,
  tm_zone = 0x280cb8e8 "EST"}
(gdb)

After the call to mktime note the year is now 100 and the month is 0.

Am I missing something here? My code using mktime worked yesterday, but
quit working today :(

It took me hours to figure out what was going on. Anyone?

Rick Weldon

2. UMSDOS Problem

3. Newbie question about Y2K compliance

4. Newbie linuxconf installation problem

5. FreeBSD Y2K compliance on non-compliant hardware

6. POP3 Client for Solaris 2.x?

7. Y2K compliance

8. 2.4.18 vs 2.4.2

9. Y2K Compliance

10. tcp wrappers y2k compliance.

11. Linux (Red Hat 5.1 and 5.2) Y2K compliance

12. Y2K Compliance's

13. Y2K Compliance of Digital Unix 4.0.b