Re: [PATCH 1/6] msvcrt: Rewrite asctime function
Piotr Caban <piotr(a)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 ;-) -- Alexandre Julliard julliard(a)winehq.org
On Tue, Apr 10, 2012 at 03:09:52PM +0200, Alexandre Julliard wrote:
Piotr Caban <piotr(a)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(a)l8s.co.uk
On 04/10/12 20:04, David Laight wrote:
But see also http://www.hermetic.ch/cal_stud/cal_art.html for some info about which years were/are actually leap years ... This is not how msvcrt handles dates. Additionally most of the functions are refusing to work on dates before 1900.
participants (3)
-
Alexandre Julliard -
David Laight -
Piotr Caban