summaryrefslogtreecommitdiff
path: root/cpukit/posix/include/rtems/posix/time.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/posix/include/rtems/posix/time.h')
-rw-r--r--cpukit/posix/include/rtems/posix/time.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/cpukit/posix/include/rtems/posix/time.h b/cpukit/posix/include/rtems/posix/time.h
index 13418cf473..eb3376cc60 100644
--- a/cpukit/posix/include/rtems/posix/time.h
+++ b/cpukit/posix/include/rtems/posix/time.h
@@ -13,6 +13,23 @@
#include <rtems/score/tod.h>
+/* Absolute Timeout Conversion Results
+ *
+ * This enumeration defines the possible results of converting
+ * an absolute time used for timeouts to POSIX blocking calls to
+ * a number of ticks.
+ */
+typedef enum {
+ /* The timeout is invalid. */
+ POSIX_ABSOLUTE_TIMEOUT_INVALID,
+ /* The timeout represents a time that is in the past. */
+ POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST,
+ /* The timeout represents a time that is equal to the current time. */
+ POSIX_ABSOLUTE_TIMEOUT_IS_NOW,
+ /* The timeout represents a time that is in the future. */
+ POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE,
+} POSIX_Absolute_timeout_conversion_results_t;
+
/*
* Seconds from January 1, 1970 to January 1, 1988. Used to account for
* differences between POSIX API and RTEMS core.
@@ -51,4 +68,24 @@ void _POSIX_Interval_to_timespec(
struct timespec *time
);
+/*
+ * Convert Absolute Timeout to Ticks
+ *
+ * This method takes an absolute time being used as a timeout
+ * to a blocking directive, validates it and returns the number
+ * of corresponding clock ticks for use by the SuperCore.
+ *
+ * abstime - is the timeout
+ * ticks_out - will contain the number of ticks
+ *
+ * This method returns the number of ticks in @a ticks_out
+ * and a status value indicating whether the absolute time
+ * is valid, in the past, equal to the current time or in
+ * the future as it should be.
+ */
+POSIX_Absolute_timeout_conversion_results_t _POSIX_Absolute_timeout_to_ticks(
+ const struct timespec *abstime,
+ Watchdog_Interval *ticks_out
+);
+
#endif