summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/tod.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2011-09-29 09:55:54 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2011-09-29 09:55:54 +0000
commit8d7aea0d28cd7504ea406537040d1bbe2f634a29 (patch)
tree5f9247e2d03b415da2ea560334f8f70ed332be0d /cpukit/score/include/rtems/score/tod.h
parent2011-09-29 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff)
downloadrtems-8d7aea0d28cd7504ea406537040d1bbe2f634a29.tar.bz2
2011-09-29 Sebastian Huber <sebastian.huber@embedded-brains.de>
* 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.
Diffstat (limited to 'cpukit/score/include/rtems/score/tod.h')
-rw-r--r--cpukit/score/include/rtems/score/tod.h45
1 files changed, 33 insertions, 12 deletions
diff --git a/cpukit/score/include/rtems/score/tod.h b/cpukit/score/include/rtems/score/tod.h
index f92e07000a..c8684ae6cc 100644
--- a/cpukit/score/include/rtems/score/tod.h
+++ b/cpukit/score/include/rtems/score/tod.h
@@ -163,27 +163,48 @@ SCORE_EXTERN Timestamp_Control _TOD_Uptime;
void _TOD_Handler_initialization(void);
/**
- * @brief _TOD_Set
+ * @brief Sets the time of day according to @a tod_as_timestamp.
*
- * This routine sets the current time of day to @a time and
- * the equivalent SECONDS_SINCE_EPOCH.
+ * The @a tod_as_timestamp timestamp represents the time since UNIX epoch. The watchdog
+ * seconds chain will be adjusted.
*/
-void _TOD_Set(
- const struct timespec *time
+void _TOD_Set_with_timestamp(
+ const Timestamp_Control *tod_as_timestamp
);
+static inline void _TOD_Set(
+ const struct timespec *tod_as_timespec
+)
+{
+ Timestamp_Control tod_as_timestamp;
+
+ _Timestamp_Set(
+ &tod_as_timestamp,
+ tod_as_timespec->tv_sec,
+ tod_as_timespec->tv_nsec
+ );
+ _TOD_Set_with_timestamp( &tod_as_timestamp );
+}
+
/**
- * @brief _TOD_Get
- *
- * This routine returns the current time of day with potential accuracy
- * to the nanosecond.
+ * @brief Returns the time of day in @a tod_as_timestamp.
*
- * @param[in] time is a pointer to the time to be returned
+ * The @a tod_as_timestamp timestamp represents the time since UNIX epoch.
*/
-void _TOD_Get(
- struct timespec *time
+void _TOD_Get_as_timestamp(
+ Timestamp_Control *tod_as_timestamp
);
+static inline void _TOD_Get(
+ struct timespec *tod_as_timespec
+)
+{
+ Timestamp_Control tod_as_timestamp;
+
+ _TOD_Get_as_timestamp( &tod_as_timestamp );
+ _Timestamp_To_timespec( &tod_as_timestamp, tod_as_timespec );
+}
+
/**
* @brief _TOD_Get_uptime
*