[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: Y2K bugs in OpenLDAP (ITS#233)
> You are referring, I assume, to the YEAR_PEDANTIC macro.
> You'll note that this macro is not used.
True, but the YEAR_CAREFUL macro is:
#define YEAR_CAREFUL(y) ((y) < 1900 ? (y) + 1900 : (y))
...
#define YEAR(y) YEAR_CAREFUL(y)
The check for (y) < 1900 is mostly harmless, I suppose, but it could
be dangerously confusing. If tm_year >= 1900, you can safely assume
one of two things: either the C runtime is badly broken, or the current
year is 3800 or later.
My suggestion: just assume that tm_year really is year-1900. If you
really want to be paranoid, add an assert; if the runtime gets this
wrong, there's not much point in trying to recover.
(Why oh why isn't tm_year just the current year? I suspect this is
a classic example of why "backward compatibility" includes the word
"backward". But as long as we're stuck with it...)
--
Keith Thompson, San Diego Supercomputer Center kst@sdsc.edu
<http://www.sdsc.edu/~kst/> Office: 858-822-0853 Fax: 858-534-5077
One of the great tragedies of ancient history is that Helen of Troy
lived before the invention of the champagne bottle.