[PATCH 1/6] msvcrt: Rewrite asctime function

David Laight david at l8s.co.uk
Tue Apr 10 13:04:45 CDT 2012


On Tue, Apr 10, 2012 at 03:09:52PM +0200, Alexandre Julliard wrote:
> Piotr Caban <piotr at codeweavers.com> writes:
> 
> > @@ -48,7 +49,7 @@ static const int MonthLengths[2][12] =
> >  
> >  static inline int IsLeapYear(int Year)
> >  {
> > -    return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0);
> > +    return (Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)) ? 1 : 0;
> 
> Maybe you should do something like:
> 
>     return (((Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)) ? 1 : 0) ? 1 : 0) ? 1 : 0;
> 
> to make really sure you get 0 or 1, you never know what might happen ;-)

But see also http://www.hermetic.ch/cal_stud/cal_art.html for some
info about which years were/are actually leap years ...

	David

-- 
David Laight: david at l8s.co.uk



More information about the wine-devel mailing list