From 8d7aea0d28cd7504ea406537040d1bbe2f634a29 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 29 Sep 2011 09:55:54 +0000 Subject: 2011-09-29 Sebastian Huber * score/include/rtems/score/tod.h: Declare _TOD_Set_with_timestamp() and _TOD_Get_as_timestamp(). * score/src/coretodset.c: Define _TOD_Set_with_timestamp(). * score/src/coretodget.c: Define _TOD_Get_as_timestamp(). * rtems/src/clockset.c: Use _TOD_Set_with_timestamp(). * score/include/rtems/score/timestamp64.h, score/src/ts64set.c: Changed parameter types of _Timestamp64_Set(). * rtems/src/clocktodtoseconds.c: Year 2100 is not a leap year. --- cpukit/rtems/src/clocktodtoseconds.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cpukit/rtems/src/clocktodtoseconds.c') diff --git a/cpukit/rtems/src/clocktodtoseconds.c b/cpukit/rtems/src/clocktodtoseconds.c index 7de1838b6e..7f867a4857 100644 --- a/cpukit/rtems/src/clocktodtoseconds.c +++ b/cpukit/rtems/src/clocktodtoseconds.c @@ -18,6 +18,8 @@ #include #include +#define TOD_SECONDS_AT_2100_03_01_00_00 4107538800UL + /* * The following array contains the number of days in all months * up to the month indicated by the index of the second dimension. @@ -78,6 +80,12 @@ uint32_t _TOD_To_seconds( time += the_tod->second; + /* The year 2100 is not a leap year */ + if ( time + >= (TOD_SECONDS_AT_2100_03_01_00_00 - TOD_SECONDS_1970_THROUGH_1988)) { + time -= TOD_SECONDS_PER_DAY; + } + time += TOD_SECONDS_1970_THROUGH_1988; return( time ); -- cgit v1.2.3