[rtems commit] Fix leap year calculation
Gedare Bloom
gedare at rtems.org
Thu Dec 5 16:50:15 UTC 2013
Module: rtems
Branch: master
Commit: 8ed1a54c57dbeb8319f040e68466fc343950bf14
Changeset: http://git.rtems.org/rtems/commit/?id=8ed1a54c57dbeb8319f040e68466fc343950bf14
Author: Nickolay Semyonov-Kolchin <nbkolchin at gmail.com>
Date: Thu Jun 4 10:54:40 2009 -0500
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 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/cpukit/rtems/src/clocktodvalidate.c b/cpukit/rtems/src/clocktodvalidate.c
index ad07098..18354ed 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 ];
More information about the vc
mailing list