summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/tod.h
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-04-05 21:17:27 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-04-05 21:17:27 +0000
commit412dbff629308745d967718fbd91e272c91b055c (patch)
tree7fb92204e9ab59173a92e8950d633cc4b39e16ac /cpukit/score/include/rtems/score/tod.h
parent2007-04-05 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-412dbff629308745d967718fbd91e272c91b055c.tar.bz2
2007-04-05 Joel Sherrill <joel@OARcorp.com>
* posix/Makefile.am, posix/include/rtems/posix/time.h, posix/src/adjtime.c, posix/src/alarm.c, posix/src/clockgetres.c, posix/src/condtimedwait.c, posix/src/mqueuetimedreceive.c, posix/src/mqueuetimedsend.c, posix/src/mutextimedlock.c, posix/src/nanosleep.c, posix/src/posixtimespecabsolutetimeout.c, posix/src/pthread.c, posix/src/pthreadcreate.c, posix/src/pthreadsetschedparam.c, posix/src/ptimer1.c, posix/src/sched.c, posix/src/semtimedwait.c, posix/src/sigtimedwait.c, posix/src/ualarm.c, rtems/src/clocktodtoseconds.c, score/Makefile.am, score/preinstall.am, score/include/rtems/score/tod.h, score/inline/rtems/score/tod.inl, score/src/coretod.c, score/src/coretodget.c, score/src/coretodgetuptime.c, score/src/coretodset.c, score/src/coretodtickle.c: Provide timespec manipulation routines in the SuperCore. Use them everywhere possible. This lead to significant cleanup in the API routines and eliminated some of the same code from the POSIX API. At this point, the SuperCore keeps time in POSIX timespec format properly from 1970. You just cannot set it before 1988 in keeping with RTEMS traditional behavior. * score/include/rtems/score/timespec.h, score/src/timespecaddto.c, score/src/timespecfromticks.c, score/src/timespecisvalid.c, score/src/timespeclessthan.c, score/src/timespecsubtract.c, score/src/timespectoticks.c: New files. * posix/src/posixintervaltotimespec.c, posix/src/posixtimespecsubtract.c, posix/src/posixtimespectointerval.c: Removed.
Diffstat (limited to 'cpukit/score/include/rtems/score/tod.h')
-rw-r--r--cpukit/score/include/rtems/score/tod.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/cpukit/score/include/rtems/score/tod.h b/cpukit/score/include/rtems/score/tod.h
index c07a48a3e5..a0c252e376 100644
--- a/cpukit/score/include/rtems/score/tod.h
+++ b/cpukit/score/include/rtems/score/tod.h
@@ -137,7 +137,7 @@ SCORE_EXTERN struct timespec _TOD_Uptime;
* The following contains the number of seconds from 00:00:00
* January 1, TOD_BASE_YEAR until the current time of day.
*/
-SCORE_EXTERN Watchdog_Interval _TOD_Seconds_since_epoch;
+#define _TOD_Seconds_since_epoch (_TOD_Now.tv_sec)
/** @brief Microseconds per Clock Tick
*
@@ -217,6 +217,17 @@ void _TOD_Tickle_ticks( void );
#define TOD_MILLISECONDS_TO_TICKS(_ms) \
(TOD_MILLISECONDS_TO_MICROSECONDS(_ms) / _TOD_Microseconds_per_tick)
+
+/** @brief How many ticks in a second?
+ *
+ * This macro returns the number of ticks in a second.
+ *
+ * @note If the clock tick value does not multiply evenly into a second
+ * then this number of ticks will be slightly shorter than a second.
+ */
+#define TOD_TICKS_PER_SECOND \
+ (TOD_MICROSECONDS_PER_SECOND / _TOD_Microseconds_per_tick)
+
#ifndef __RTEMS_APPLICATION__
#include <rtems/score/tod.inl>
#endif