From 8ed1a54c57dbeb8319f040e68466fc343950bf14 Mon Sep 17 00:00:00 2001 From: Nickolay Semyonov-Kolchin Date: Thu, 4 Jun 2009 10:54:40 -0500 Subject: Fix leap year calculation Reference: http://en.wikipedia.org/wiki/Leap_year Bug: https://www.rtems.org/bugzilla/show_bug.cgi?id=1422 --- cpukit/rtems/src/clocktodvalidate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpukit/rtems/src/clocktodvalidate.c b/cpukit/rtems/src/clocktodvalidate.c index ad07098b31..18354ed6e0 100644 --- a/cpukit/rtems/src/clocktodvalidate.c +++ b/cpukit/rtems/src/clocktodvalidate.c @@ -53,7 +53,8 @@ bool _TOD_Validate( (the_tod->day == 0) ) return false; - if ( (the_tod->year % 4) == 0 ) + if (((the_tod->year % 4) == 0 && (the_tod->year % 100 != 0)) || + (the_tod->year % 400 == 0)) days_in_month = _TOD_Days_per_month[ 1 ][ the_tod->month ]; else days_in_month = _TOD_Days_per_month[ 0 ][ the_tod->month ]; -- cgit v1.2.3