Pete Forman writes:
 > One workaround would be to add 4*n to tm_year and subtract (365*4+1)
 > *24*60*60*n from the time_t returned.  (All leap years are multiples
 > of 4 in the range 1901 to 2038.  If tm_wday is wanted, that will need
 > to be adjusted as well.)

FWIW, that should be to add 28*n to tm_year and subtract (365*4+1)*7
*24*60*60*n from the time_t returned.  That calculates tm_wday
correctly.

Also I should have been more explicit that this applies only to AIX
and IRIX.  Those return -1 from mktime(year < 1970) and do not allow
DST rules to vary from year to year.  Linux and Solaris have more
capable date libraries.
-- 
Pete Forman   http://www.bedford.waii.com/wsdev/petef/PeteF_links.html
WesternGeco                           http://www.crosswinds.net/~petef
Manton Lane, Bedford,               mailto:[EMAIL PROTECTED]
MK41 7PA, UK                  tel:+44-1234-224798  fax:+44-1234-224804

Reply via email to