Subject: Re: lib/10521: y2k bug in mktime
To: Andrew Brown <firstname.lastname@example.org>
From: Wolfgang Rupprecht <email@example.com>
Date: 07/06/2000 08:57:03
Andrew Brown writes:
> that's because the tm_year member of struct tm is defined to be the
> number of years since 1900. man localtime(3). the programmer is
> expected to convert dates to this format.
It seems that everyone but me remembered that tm_year is still based
on a 1900 offset. I guess we should note this in the
ctime(3)/mktime(3) man page, which is what I looked at to remind
myself of the calling convention.
The fact that most other code has been fixed to deal gracefully with
4-digit years leads one to *assume* that the rest of the routines will
follow the principal of least surprise. Since the computer can DTRT
in this case I wonder if it wouldn't be better to have mktime()
understand the normal windowing hack of small-number means offset from
some epoch (1900, or denis richie's birthday or whatever) and
large-number means the more conventional year in 4-digit notation.
The beauty of "standards". Some of them are down-right
Wolfgang Rupprecht <firstname.lastname@example.org> http://www.wsrcc.com/wolfgang/
DGPS signals via the Internet http://www.wsrcc.com/wolfgang/gps/dgps-ip.html