diff options
author | Nickolay Semyonov-Kolchin <nbkolchin@gmail.com> | 2009-06-04 10:54:40 -0500 |
---|---|---|
committer | Gedare Bloom <gedare@rtems.org> | 2013-12-05 11:57:06 -0500 |
commit | 8ed1a54c57dbeb8319f040e68466fc343950bf14 (patch) | |
tree | 789bcfafccbed77302fbdb84a231d5d1e419eda7 | |
parent | sptest: sp2038: Add a test for leap year (diff) | |
download | rtems-8ed1a54c57dbeb8319f040e68466fc343950bf14.tar.bz2 |
Fix leap year calculation
Reference: http://en.wikipedia.org/wiki/Leap_year
Bug: https://www.rtems.org/bugzilla/show_bug.cgi?id=1422
-rw-r--r-- | cpukit/rtems/src/clocktodvalidate.c | 3 |
1 files changed, 2 insertions, 1 deletions
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 ]; |