[htdig3-dev] mytimegm() not Y2K compliant!


Gilles Detillieux (grdetil@scrc.umanitoba.ca)
Fri, 26 Feb 1999 16:36:37 -0600 (CST)


Hi, all. I haven't actually tested it, but upon perusing the code for
mytimegm(), it seems it won't treat the year 2000 correctly as a leap
year.

The LEAP_YEAR() macro is currently:

  #define LEAP_YEAR(y) (((y)%4 == 0) && ((y)%100 != 0 || (y)%400 == 0))

This would work fine if it were given the full 4 digit year, but
it's given tm_year format years, i.e. year-1900. So, in the year
2000, the tm_year will be 100, for which the macro would return 0.

It seems to me the LEAP_YEAR() macro should be:

  #define LEAP_YEAR(y) ((((y+1900))%4 == 0) && (((y+1900))%100 != 0 || ((y+1900))%400 == 0))

-- 
Gilles R. Detillieux              E-mail: <grdetil@scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930
------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
htdig3-dev@htdig.org containing the single word "unsubscribe" in
the SUBJECT of the message.



This archive was generated by hypermail 2.0b3 on Fri Feb 26 1999 - 15:00:29 PST