summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-04-02 18:23:59 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-04-02 18:23:59 +0000
commit812da546889eea0b6dea7eb2954f46a4c43d1314 (patch)
tree22fc95d921c3544de770454a2f9c604d5d0a27a2 /cpukit/score
parent2007-04-02 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-812da546889eea0b6dea7eb2954f46a4c43d1314.tar.bz2
2007-04-02 Joel Sherrill <joel@OARcorp.com>
* itron/src/itrontime.c, libcsupport/src/__gettod.c, posix/include/rtems/posix/time.h, posix/include/rtems/posix/timer.h, posix/src/clockgettime.c, posix/src/clocksettime.c, posix/src/nanosleep.c, posix/src/posixtimespecsubtract.c, posix/src/posixtimespectointerval.c, posix/src/ptimer1.c, posix/src/sleep.c, rtems/Makefile.am, rtems/include/rtems/rtems/clock.h, rtems/include/rtems/rtems/timer.h, rtems/include/rtems/rtems/types.h, rtems/src/clockget.c, rtems/src/clockset.c, rtems/src/clocktodtoseconds.c, rtems/src/clocktodvalidate.c, rtems/src/taskwakewhen.c, score/Makefile.am, score/include/rtems/score/tod.h, score/inline/rtems/score/tod.inl, score/src/coretod.c, score/src/coretodset.c: Convert from Classic API style TOD_Control as fundamental time structure to POSIX struct timespec. Add clock_get_uptime(). * rtems/src/clockgetuptime.c, score/src/coretodget.c, score/src/coretodgetuptime.c: New files. * score/src/coretodtickle.c, score/src/coretodtoseconds.c, score/src/coretodvalidate.c: Removed.
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/Makefile.am8
-rw-r--r--cpukit/score/include/rtems/score/tod.h144
-rw-r--r--cpukit/score/inline/rtems/score/tod.inl75
-rw-r--r--cpukit/score/src/coretod.c21
-rw-r--r--cpukit/score/src/coretodget.c53
-rw-r--r--cpukit/score/src/coretodgetuptime.c52
-rw-r--r--cpukit/score/src/coretodset.c28
-rw-r--r--cpukit/score/src/coretodtickle.c71
-rw-r--r--cpukit/score/src/coretodtoseconds.c67
-rw-r--r--cpukit/score/src/coretodvalidate.c67
10 files changed, 236 insertions, 350 deletions
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index bf5e15eb1a..59b227a29a 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -140,12 +140,12 @@ libscore_a_SOURCES += src/threadq.c src/threadqdequeue.c \
src/threadqtimeout.c
## TOD_C_FILES
-libscore_a_SOURCES += src/coretod.c src/coretodset.c src/coretodtickle.c \
- src/coretodtoseconds.c src/coretodvalidate.c
+libscore_a_SOURCES += src/coretod.c src/coretodset.c src/coretodget.c \
+ src/coretodgetuptime.c
## WATCHDOG_C_FILES
-libscore_a_SOURCES += src/watchdog.c src/watchdogadjust.c src/watchdoginsert.c \
- src/watchdogremove.c src/watchdogtickle.c
+libscore_a_SOURCES += src/watchdog.c src/watchdogadjust.c \
+ src/watchdoginsert.c src/watchdogremove.c src/watchdogtickle.c
## STD_C_FILES
libscore_a_SOURCES += src/apiext.c src/chain.c \
diff --git a/cpukit/score/include/rtems/score/tod.h b/cpukit/score/include/rtems/score/tod.h
index 8f5256e245..8de4bb9304 100644
--- a/cpukit/score/include/rtems/score/tod.h
+++ b/cpukit/score/include/rtems/score/tod.h
@@ -6,7 +6,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2006.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -32,6 +32,7 @@ extern "C" {
#include <rtems/score/object.h>
#include <rtems/score/watchdog.h>
+#include <time.h>
/** @defgroup ScoreTODConstants TOD Constants
* The following constants are related to the time of day.
@@ -96,6 +97,15 @@ extern "C" {
*/
#define TOD_NANOSECONDS_PER_MICROSECOND (uint32_t)1000
+/*
+ * Seconds from January 1, 1970 to January 1, 1988. Used to account for
+ * differences between POSIX API and RTEMS core. The timespec format time
+ * is kept in POSIX compliant form.
+ */
+#define TOD_SECONDS_1970_THROUGH_1988 \
+ (((1987 - 1970 + 1) * TOD_SECONDS_PER_NON_LEAP_YEAR) + \
+ (4 * TOD_SECONDS_PER_DAY))
+
/**@}*/
/** @brief RTEMS Epoch Year
@@ -106,29 +116,6 @@ extern "C" {
*/
#define TOD_BASE_YEAR 1988
-/**
- * The following record defines the time of control block. This
- * control block is used to maintain the current time of day.
- *
- * @note This is an RTEID style time/date.
- */
-typedef struct {
- /** This field is the year, A.D. */
- uint32_t year;
- /** This field is the month, 1 -> 12 */
- uint32_t month;
- /** This field is the day, 1 -> 31 */
- uint32_t day;
- /** This field is the hour, 0 -> 23 */
- uint32_t hour;
- /** This field is the minute, 0 -> 59 */
- uint32_t minute;
- /** This field is the second, 0 -> 59 */
- uint32_t second;
- /** This field is the elapsed ticks between secs */
- uint32_t ticks;
-} TOD_Control;
-
/** @brief Is the Time Of Day Set
*
* This is TRUE if the application has set the current
@@ -136,10 +123,15 @@ typedef struct {
*/
SCORE_EXTERN boolean _TOD_Is_set;
-/** @brief Current Time of Day
+/** @brief Current Time of Day (Timespec)
* The following contains the current time of day.
*/
-SCORE_EXTERN TOD_Control _TOD_Current;
+SCORE_EXTERN struct timespec _TOD_Now;
+
+/** @brief Current Time of Day (Timespec)
+ * The following contains the running uptime.
+ */
+SCORE_EXTERN struct timespec _TOD_Uptime;
/** @brief Seconds Since RTEMS Epoch
* The following contains the number of seconds from 00:00:00
@@ -164,69 +156,6 @@ SCORE_EXTERN uint32_t _TOD_Microseconds_per_tick;
*/
SCORE_EXTERN uint32_t _TOD_Ticks_per_second;
-/** @brief Watchdog Set Managed by Seconds
- *
- * This is the control structure for the watchdog timer which
- * fires to service the seconds chain.
- */
-SCORE_EXTERN Watchdog_Control _TOD_Seconds_watchdog;
-
-#ifdef SCORE_INIT
-
-/*
- * The following array contains the number of days in all months.
- * The first dimension should be 1 for leap years, and 0 otherwise.
- * The second dimension should range from 1 to 12 for January to
- * February, respectively.
- */
-const uint32_t _TOD_Days_per_month[ 2 ][ 13 ] = {
- { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
- { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
-};
-
-/*
- * The following array contains the number of days in all months
- * up to the month indicated by the index of the second dimension.
- * The first dimension should be 1 for leap years, and 0 otherwise.
- */
-const uint16_t _TOD_Days_to_date[2][13] = {
- { 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 },
- { 0, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 }
-};
-
-/*
- * The following array contains the number of days in the years
- * since the last leap year. The index should be 0 for leap
- * years, and the number of years since the beginning of a leap
- * year otherwise.
- */
-const uint16_t _TOD_Days_since_last_leap_year[4] = { 0, 366, 731, 1096 };
-
-#else
-
-/** @brief Convert Month to Julian Days
- *
- * This is a prototype for a table which assists in converting the
- * current day into the Julian days since the first of the year.
- */
-extern const uint16_t _TOD_Days_to_date[2][13]; /* Julian days */
-
-/** @brief Days since Beginning of Last Leap Year
- *
- * This is a prototype for a table which assists in calculating the
- * number of days since the beginning of the last leap year.
- */
-extern const uint16_t _TOD_Days_since_last_leap_year[4];
-
-/** @brief Days Per Month Table
- *
- * This is a prototype for a table which holds the number of days
- * per month for a leap year and non-leap year.
- */
-extern const uint32_t _TOD_Days_per_month[2][13];
-
-#endif
-
/** @brief _TOD_Handler_initialization
*
* This routine performs the initialization necessary for this handler.
@@ -237,40 +166,33 @@ void _TOD_Handler_initialization(
/** @brief _TOD_Set
*
- * This routine sets the current time of day to THE_TOD and
+ * This routine sets the current time of day to @a time and
* the equivalent SECONDS_SINCE_EPOCH.
*/
void _TOD_Set(
- TOD_Control *the_tod,
- Watchdog_Interval seconds_since_epoch
+ const struct timespec *time
);
-/** @brief _TOD_Validate
+/** @brief _TOD_Get
*
- * This function returns TRUE if THE_TOD contains
- * a valid time of day, and FALSE otherwise.
- */
-boolean _TOD_Validate(
- TOD_Control *the_tod
-);
-
-/** @brief _TOD_To_seconds
+ * This routine returns the current time of day with potential accuracy
+ * to the nanosecond.
*
- * This function returns the number seconds between the epoch and THE_TOD.
+ * @param[in] time is a pointer to the time to be returned
*/
-Watchdog_Interval _TOD_To_seconds(
- TOD_Control *the_tod
+void _TOD_Get(
+ struct timespec *time
);
-/** @brief _TOD_Tickle
+/** @brief _TOD_Get_uptime
+ *
+ * This routine returns the system uptime with potential accuracy
+ * to the nanosecond.
*
- * This routine is scheduled as a watchdog function and is invoked at
- * each second boundary. It updates the current time of day to indicate
- * that a second has passed and processes the seconds watchdog chain.
+ * @param[in] time is a pointer to the uptime to be returned
*/
-void _TOD_Tickle(
- Objects_Id id,
- void *ignored
+void _TOD_Get_uptime(
+ struct timespec *time
);
/** @brief TOD_MILLISECONDS_TO_MICROSECONDS
diff --git a/cpukit/score/inline/rtems/score/tod.inl b/cpukit/score/inline/rtems/score/tod.inl
index 428989b0f7..733c4e1ede 100644
--- a/cpukit/score/inline/rtems/score/tod.inl
+++ b/cpukit/score/inline/rtems/score/tod.inl
@@ -6,7 +6,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2004.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -19,20 +19,68 @@
#ifndef _RTEMS_SCORE_TOD_INL
#define _RTEMS_SCORE_TOD_INL
+#include <rtems/score/isr.h>
+
/**
* @addtogroup ScoreTOD
* @{
*/
/**
+ *
+ * This routines adds two timespecs. The second argument is added
+ * to the first.
+ */
+
+RTEMS_INLINE_ROUTINE uint32_t _TOD_Add_timespec(
+ struct timespec *time,
+ struct timespec *add
+)
+{
+ uint32_t seconds = 0;
+
+
+ /* Add the basics */
+ time->tv_sec += add->tv_sec;
+ time->tv_nsec += add->tv_nsec;
+
+ /* Now adjust it so nanoseconds is in range */
+ while ( time->tv_nsec >= TOD_NANOSECONDS_PER_SECOND ) {
+ time->tv_nsec -= TOD_NANOSECONDS_PER_SECOND;
+ time->tv_sec++;
+ seconds++;
+ }
+
+ return seconds;
+}
+
+/**
* This routine increments the ticks field of the current time of
* day at each clock tick.
*/
RTEMS_INLINE_ROUTINE void _TOD_Tickle_ticks( void )
{
- _TOD_Current.ticks += 1;
+ struct timespec tick;
+ uint32_t seconds;
+
+ /* Convert the tick quantum to a timespec */
+ tick.tv_nsec = _TOD_Microseconds_per_tick * 1000;
+ tick.tv_sec = 0;
+
+ /* Update the counter of ticks since boot */
_Watchdog_Ticks_since_boot += 1;
+
+ /* Update the timespec format uptime */
+ (void) _TOD_Add_timespec( &_TOD_Uptime, &tick );
+ /* we do not care how much the uptime changed */
+
+ /* Update the timespec format TOD */
+ seconds = _TOD_Add_timespec( &_TOD_Now, &tick );
+ while ( seconds ) {
+ _Watchdog_Tickle_seconds();
+ seconds--;
+ }
}
/**
@@ -41,7 +89,7 @@ RTEMS_INLINE_ROUTINE void _TOD_Tickle_ticks( void )
RTEMS_INLINE_ROUTINE void _TOD_Deactivate( void )
{
- _Watchdog_Remove( &_TOD_Seconds_watchdog );
+ /* XXX do we need something now that we are using timespec for TOD */
}
/**
@@ -52,7 +100,26 @@ RTEMS_INLINE_ROUTINE void _TOD_Activate(
Watchdog_Interval ticks
)
{
- _Watchdog_Insert_ticks( &_TOD_Seconds_watchdog, ticks );
+ /* XXX do we need something now that we are using timespec for TOD */
+}
+
+/**
+ * This routine returns a timeval based upon the internal timespec format TOD.
+ */
+
+RTEMS_INLINE_ROUTINE void _TOD_Get_timeval(
+ struct timeval *time
+)
+{
+ ISR_Level level;
+ struct timespec now;
+
+ _ISR_Disable(level);
+ _TOD_Get( &now );
+ _ISR_Enable(level);
+
+ time->tv_sec = now.tv_sec;
+ time->tv_usec = now.tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND;
}
/**@}*/
diff --git a/cpukit/score/src/coretod.c b/cpukit/score/src/coretod.c
index 4824be2c36..142d8782bc 100644
--- a/cpukit/score/src/coretod.c
+++ b/cpukit/score/src/coretod.c
@@ -40,24 +40,25 @@ void _TOD_Handler_initialization(
{
_TOD_Microseconds_per_tick = microseconds_per_tick;
- _TOD_Seconds_since_epoch = 0;
+ /* POSIX format TOD (timespec) */
+ _TOD_Now.tv_sec = TOD_SECONDS_1970_THROUGH_1988;
+ _TOD_Now.tv_nsec = 0;
+
+ /* Uptime (timespec) */
+ _TOD_Uptime.tv_sec = 0;
+ _TOD_Uptime.tv_nsec = 0;
- _TOD_Current.year = TOD_BASE_YEAR;
- _TOD_Current.month = 1;
- _TOD_Current.day = 1;
- _TOD_Current.hour = 0;
- _TOD_Current.minute = 0;
- _TOD_Current.second = 0;
- _TOD_Current.ticks = 0;
+ /* Seconds since RTEMS Epoch (1988) */
+ _TOD_Seconds_since_epoch = 0;
+ /* Protect ourselves from a divide by zero fault */
if ( microseconds_per_tick == 0 )
_TOD_Ticks_per_second = 0;
else
_TOD_Ticks_per_second =
TOD_MICROSECONDS_PER_SECOND / microseconds_per_tick;
- _Watchdog_Initialize( &_TOD_Seconds_watchdog, _TOD_Tickle, 0, NULL );
-
+ /* TOD has not been set */
_TOD_Is_set = FALSE;
_TOD_Activate( _TOD_Ticks_per_second );
}
diff --git a/cpukit/score/src/coretodget.c b/cpukit/score/src/coretodget.c
new file mode 100644
index 0000000000..96ae194f30
--- /dev/null
+++ b/cpukit/score/src/coretodget.c
@@ -0,0 +1,53 @@
+/*
+ * Time of Day (TOD) Handler - get TOD
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/tod.h>
+
+/*
+ * _TOD_Get
+ *
+ * This routine is used to obtain the current date and time.
+ *
+ * Input parameters:
+ * time - pointer to the time and date structure
+ *
+ * Output parameters: NONE
+ */
+
+void _TOD_Get(
+ struct timespec *time
+)
+{
+ ISR_Level level;
+ struct timespec offset;
+
+ /* assume time checked by caller */
+
+ offset.tv_sec = 0;
+ offset.tv_nsec = 0;
+
+ /* _TOD_Now is a proper POSIX time */
+ _ISR_Disable( level );
+ *time = _TOD_Now;
+ if ( _Watchdog_Nanoseconds_since_tick_handler )
+ offset.tv_nsec = (*_Watchdog_Nanoseconds_since_tick_handler)();
+ _ISR_Enable( level );
+
+ _TOD_Add_timespec( time, &offset );
+}
diff --git a/cpukit/score/src/coretodgetuptime.c b/cpukit/score/src/coretodgetuptime.c
new file mode 100644
index 0000000000..e420c0863d
--- /dev/null
+++ b/cpukit/score/src/coretodgetuptime.c
@@ -0,0 +1,52 @@
+/*
+ * Time of Day (TOD) Handler - get uptime
+ *
+ * COPYRIGHT (c) 1989-2007.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/isr.h>
+#include <rtems/score/tod.h>
+
+/*
+ * _TOD_Get_uptime
+ *
+ * This routine is used to obtain the system uptime
+ *
+ * Input parameters:
+ * time - pointer to the time and date structure
+ *
+ * Output parameters: NONE
+ */
+
+void _TOD_Get_uptime(
+ struct timespec *uptime
+)
+{
+ ISR_Level level;
+ struct timespec offset;
+
+ /* assume uptime checked by caller */
+
+ offset.tv_sec = 0;
+ offset.tv_nsec = 0;
+
+ _ISR_Disable( level );
+ *uptime = _TOD_Uptime;
+ if ( _Watchdog_Nanoseconds_since_tick_handler )
+ offset.tv_nsec = (*_Watchdog_Nanoseconds_since_tick_handler)();
+ _ISR_Enable( level );
+
+ _TOD_Add_timespec( uptime, &offset );
+}
diff --git a/cpukit/score/src/coretodset.c b/cpukit/score/src/coretodset.c
index ae7ec65b30..21f77d8001 100644
--- a/cpukit/score/src/coretodset.c
+++ b/cpukit/score/src/coretodset.c
@@ -30,37 +30,33 @@
* new date and time structure.
*
* Input parameters:
- * the_tod - pointer to the time and date structure
- * seconds_since_epoch - seconds since system epoch
+ * time - pointer to the time and date structure
*
* Output parameters: NONE
*/
void _TOD_Set(
- TOD_Control *the_tod,
- Watchdog_Interval seconds_since_epoch
+ const struct timespec *time
)
{
- Watchdog_Interval ticks_until_next_second;
-
_Thread_Disable_dispatch();
_TOD_Deactivate();
- if ( seconds_since_epoch < _TOD_Seconds_since_epoch )
+ if ( time->tv_sec < _TOD_Seconds_since_epoch )
_Watchdog_Adjust_seconds( WATCHDOG_BACKWARD,
- _TOD_Seconds_since_epoch - seconds_since_epoch );
+ _TOD_Seconds_since_epoch - time->tv_sec );
else
_Watchdog_Adjust_seconds( WATCHDOG_FORWARD,
- seconds_since_epoch - _TOD_Seconds_since_epoch );
-
- ticks_until_next_second = _TOD_Ticks_per_second;
- if ( ticks_until_next_second > the_tod->ticks )
- ticks_until_next_second -= the_tod->ticks;
+ time->tv_sec - _TOD_Seconds_since_epoch );
- _TOD_Current = *the_tod;
- _TOD_Seconds_since_epoch = seconds_since_epoch;
+ _TOD_Seconds_since_epoch = time->tv_sec;
_TOD_Is_set = TRUE;
- _TOD_Activate( ticks_until_next_second );
+
+ /* POSIX format TOD (timespec) */
+ _TOD_Now = *time;
+ _TOD_Now.tv_sec += TOD_SECONDS_1970_THROUGH_1988;
+
+ _TOD_Activate( 0 );
_Thread_Enable_dispatch();
}
diff --git a/cpukit/score/src/coretodtickle.c b/cpukit/score/src/coretodtickle.c
deleted file mode 100644
index d2c0fe3d46..0000000000
--- a/cpukit/score/src/coretodtickle.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Time of Day (TOD) Handler
- *
- *
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- *
- * $Id$
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/system.h>
-#include <rtems/score/object.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/tod.h>
-#include <rtems/score/watchdog.h>
-
-/*PAGE
- *
- * _TOD_Tickle
- *
- * This routine updates the calendar time and tickles the
- * per second watchdog timer chain.
- *
- * Input parameters:
- * ignored - this parameter is ignored
- *
- * Output parameters: NONE
- *
- * NOTE: This routine only works for leap-years through 2099.
- */
-
-void _TOD_Tickle(
- Objects_Id id,
- void *ignored
-)
-{
- uint32_t leap;
-
- _TOD_Current.ticks = 0;
- ++_TOD_Seconds_since_epoch;
- if ( ++_TOD_Current.second >= TOD_SECONDS_PER_MINUTE ) {
- _TOD_Current.second = 0;
- if ( ++_TOD_Current.minute >= TOD_MINUTES_PER_HOUR ) {
- _TOD_Current.minute = 0;
- if ( ++_TOD_Current.hour >= TOD_HOURS_PER_DAY ) {
- _TOD_Current.hour = 0;
- if ( _TOD_Current.year & 0x3 ) leap = 0;
- else leap = 1;
- if ( ++_TOD_Current.day >
- _TOD_Days_per_month[ leap ][ _TOD_Current.month ]) {
- _TOD_Current.day = 1;
- if ( ++_TOD_Current.month > TOD_MONTHS_PER_YEAR ) {
- _TOD_Current.month = 1;
- _TOD_Current.year++;
- }
- }
- }
- }
- }
-
- _Watchdog_Tickle_seconds();
- _Watchdog_Insert_ticks( &_TOD_Seconds_watchdog, _TOD_Ticks_per_second );
-}
diff --git a/cpukit/score/src/coretodtoseconds.c b/cpukit/score/src/coretodtoseconds.c
deleted file mode 100644
index 5bea09cc25..0000000000
--- a/cpukit/score/src/coretodtoseconds.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Time of Day (TOD) Handler
- *
- *
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- *
- * $Id$
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/system.h>
-#include <rtems/score/object.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/tod.h>
-#include <rtems/score/watchdog.h>
-
-/*PAGE
- *
- * _TOD_To_seconds
- *
- * This routine returns the seconds from the epoch until the
- * current date and time.
- *
- * Input parameters:
- * the_tod - pointer to the time and date structure
- *
- * Output parameters:
- * returns - seconds since epoch until the_tod
- */
-
-uint32_t _TOD_To_seconds(
- TOD_Control *the_tod
-)
-{
- uint32_t time;
- uint32_t year_mod_4;
-
- time = the_tod->day - 1;
- year_mod_4 = the_tod->year & 3;
-
- if ( year_mod_4 == 0 )
- time += _TOD_Days_to_date[ 1 ][ the_tod->month ];
- else
- time += _TOD_Days_to_date[ 0 ][ the_tod->month ];
-
- time += ( (the_tod->year - TOD_BASE_YEAR) / 4 ) *
- ( (TOD_DAYS_PER_YEAR * 4) + 1);
-
- time += _TOD_Days_since_last_leap_year[ year_mod_4 ];
-
- time *= TOD_SECONDS_PER_DAY;
-
- time += ((the_tod->hour * TOD_MINUTES_PER_HOUR) + the_tod->minute)
- * TOD_SECONDS_PER_MINUTE;
-
- time += the_tod->second;
-
- return( time );
-}
diff --git a/cpukit/score/src/coretodvalidate.c b/cpukit/score/src/coretodvalidate.c
deleted file mode 100644
index 6db0c9eb67..0000000000
--- a/cpukit/score/src/coretodvalidate.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Time of Day (TOD) Handler
- *
- *
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- *
- * $Id$
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/system.h>
-#include <rtems/score/object.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/tod.h>
-#include <rtems/score/watchdog.h>
-
-/*PAGE
- *
- * _TOD_Validate
- *
- * This kernel routine checks the validity of a date and time structure.
- *
- * Input parameters:
- * the_tod - pointer to a time and date structure
- *
- * Output parameters:
- * TRUE - if the date, time, and tick are valid
- * FALSE - if the the_tod is invalid
- *
- * NOTE: This routine only works for leap-years through 2099.
- */
-
-boolean _TOD_Validate(
- TOD_Control *the_tod
-)
-{
- uint32_t days_in_month;
-
- if ((!the_tod) ||
- (the_tod->ticks >= _TOD_Ticks_per_second) ||
- (the_tod->second >= TOD_SECONDS_PER_MINUTE) ||
- (the_tod->minute >= TOD_MINUTES_PER_HOUR) ||
- (the_tod->hour >= TOD_HOURS_PER_DAY) ||
- (the_tod->month == 0) ||
- (the_tod->month > TOD_MONTHS_PER_YEAR) ||
- (the_tod->year < TOD_BASE_YEAR) ||
- (the_tod->day == 0) )
- return FALSE;
-
- if ( (the_tod->year % 4) == 0 )
- days_in_month = _TOD_Days_per_month[ 1 ][ the_tod->month ];
- else
- days_in_month = _TOD_Days_per_month[ 0 ][ the_tod->month ];
-
- if ( the_tod->day > days_in_month )
- return FALSE;
-
- return TRUE;
-}