forked from Imagelibrary/rtems
Fix leap year calculation
Reference: http://en.wikipedia.org/wiki/Leap_year Bug: https://www.rtems.org/bugzilla/show_bug.cgi?id=1422
This commit is contained in:
committed by
Gedare Bloom
parent
262e250756
commit
8ed1a54c57
@@ -53,7 +53,8 @@ bool _TOD_Validate(
|
|||||||
(the_tod->day == 0) )
|
(the_tod->day == 0) )
|
||||||
return false;
|
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 ];
|
days_in_month = _TOD_Days_per_month[ 1 ][ the_tod->month ];
|
||||||
else
|
else
|
||||||
days_in_month = _TOD_Days_per_month[ 0 ][ the_tod->month ];
|
days_in_month = _TOD_Days_per_month[ 0 ][ the_tod->month ];
|
||||||
|
|||||||
Reference in New Issue
Block a user