summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/timespec.h
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-12-09 21:27:35 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-12-09 21:27:35 +0000
commite57cb3c9df68ebe3616f8276be8d6fe7e926b4f2 (patch)
tree42483f3fce61b821e9d617a8c633e7fdd53a0d19 /cpukit/score/include/rtems/score/timespec.h
parent2008-12-09 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-e57cb3c9df68ebe3616f8276be8d6fe7e926b4f2.tar.bz2
2008-12-09 Joel Sherrill <joel.sherrill@oarcorp.com>
* score/Makefile.am, score/preinstall.am, score/include/rtems/score/timespec.h, score/include/rtems/score/timestamp.h: Add 64-bit implementation of SuperCore Timestamps. Tested on PowerPC/psim and SPARC/sis. * score/include/rtems/score/timestamp64.h, score/src/ts64addto.c, score/src/ts64divide.c, score/src/ts64dividebyinteger.c, score/src/ts64equalto.c, score/src/ts64getnanoseconds.c, score/src/ts64getseconds.c, score/src/ts64greaterthan.c, score/src/ts64lessthan.c, score/src/ts64set.c, score/src/ts64settozero.c, score/src/ts64subtract.c, score/src/ts64toticks.c, score/src/ts64totimespec.c: New files.
Diffstat (limited to 'cpukit/score/include/rtems/score/timespec.h')
-rw-r--r--cpukit/score/include/rtems/score/timespec.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/timespec.h b/cpukit/score/include/rtems/score/timespec.h
index 42eb67a377..060df71f38 100644
--- a/cpukit/score/include/rtems/score/timespec.h
+++ b/cpukit/score/include/rtems/score/timespec.h
@@ -32,6 +32,56 @@ extern "C" {
#include <sys/types.h>
+/** @brief Set Timespec to Seconds Nanosecond
+ *
+ * This method sets the timespec to the specified seconds and nanoseconds
+ * value.
+ *
+ * @param[in] _time points to the timespec instance to validate.
+ * @param[in] _seconds is the seconds portion of the timespec
+ * @param[in] _nanoseconds is the nanoseconds portion of the timespec
+ */
+#define _Timespec_Set( _time, _seconds, _nanoseconds ) \
+ do { \
+ (_time)->tv_sec = (_seconds); \
+ (_time)->tv_nsec = (_nanoseconds); \
+ } while (0)
+
+/** @brief Zero Timespec
+ *
+ * This method sets the timespec to zero.
+ * value.
+ *
+ * @param[in] _time points to the timespec instance to zero.
+ */
+#define _Timespec_Set_to_zero( _time ) \
+ do { \
+ (_time)->tv_sec = 0; \
+ (_time)->tv_nsec = 0; \
+ } while (0)
+
+/** @brief Get Seconds Portion of Timespec
+ *
+ * This method returns the seconds portion of the specified timespec
+ *
+ * @param[in] _time points to the timespec
+ *
+ * @return The seconds portion of @a _time.
+ */
+#define _Timespec_Get_seconds( _time ) \
+ ((_time)->tv_sec)
+
+/** @brief Get Nanoseconds Portion of Timespec
+ *
+ * This method returns the nanoseconds portion of the specified timespec
+ *
+ * @param[in] _time points to the timespec
+ *
+ * @return The nanoseconds portion of @a _time.
+ */
+#define _Timespec_Get_nanoseconds( _time ) \
+ ((_time)->tv_nsec)
+
/** @brief Is Timespec Valid
*
* This method determines the validity of a timespec.