Quote:Original post by owl
Should I add 1 to the years passed or am I doing something wrong?
Just a shot in the dark, but you could try a nearest rounding instead of truncation when converting years to days.
(int)(year * 365.256 + 0.5)
instead of
(int)(year * 365.256)
I'm not entirely sure how my code does it (I'm converting dates to UNIX time), but I think it's using nearest rounding, and my times are off by just a second or so (just a rough implementation so far, so it works quite good in my oppinion) so it seems to handle leap years fine.