1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief POSIX Time Types |
---|
5 | * |
---|
6 | * This defines the interface to implementation helper routines related |
---|
7 | * to POSIX time types. |
---|
8 | */ |
---|
9 | |
---|
10 | /* |
---|
11 | * COPYRIGHT (c) 1989-2011. |
---|
12 | * On-Line Applications Research Corporation (OAR). |
---|
13 | * |
---|
14 | * The license and distribution terms for this file may be |
---|
15 | * found in the file LICENSE in this distribution or at |
---|
16 | * http://www.rtems.org/license/LICENSE. |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _RTEMS_POSIX_TIME_H |
---|
20 | #define _RTEMS_POSIX_TIME_H |
---|
21 | |
---|
22 | #include <rtems/score/timespec.h> |
---|
23 | #include <rtems/score/watchdog.h> |
---|
24 | /** |
---|
25 | * @defgroup POSIX_TIMETYPES POSIX Time Types |
---|
26 | * |
---|
27 | * @ingroup POSIXAPI |
---|
28 | * |
---|
29 | */ |
---|
30 | /**@{**/ |
---|
31 | |
---|
32 | /** |
---|
33 | * @brief Absolute timeout conversion results. |
---|
34 | * |
---|
35 | * This enumeration defines the possible results of converting |
---|
36 | * an absolute time used for timeouts to POSIX blocking calls to |
---|
37 | * a number of ticks. |
---|
38 | */ |
---|
39 | typedef enum { |
---|
40 | /** The timeout is invalid. */ |
---|
41 | POSIX_ABSOLUTE_TIMEOUT_INVALID, |
---|
42 | /** The timeout represents a time that is in the past. */ |
---|
43 | POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST, |
---|
44 | /** The timeout represents a time that is equal to the current time. */ |
---|
45 | POSIX_ABSOLUTE_TIMEOUT_IS_NOW, |
---|
46 | /** The timeout represents a time that is in the future. */ |
---|
47 | POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE, |
---|
48 | } POSIX_Absolute_timeout_conversion_results_t; |
---|
49 | |
---|
50 | /** |
---|
51 | * @brief Convert absolute timeout to ticks. |
---|
52 | * |
---|
53 | * This method takes an absolute time being used as a timeout |
---|
54 | * to a blocking directive, validates it and returns the number |
---|
55 | * of corresponding clock ticks for use by the SuperCore. |
---|
56 | * |
---|
57 | * @param[in] abstime is a pointer to the timeout |
---|
58 | * @param[out] ticks_out will contain the number of ticks |
---|
59 | * |
---|
60 | * @return This method returns the number of ticks in @a ticks_out |
---|
61 | * and a status value indicating whether the absolute time |
---|
62 | * is valid, in the past, equal to the current time or in |
---|
63 | * the future as it should be. |
---|
64 | */ |
---|
65 | POSIX_Absolute_timeout_conversion_results_t _POSIX_Absolute_timeout_to_ticks( |
---|
66 | const struct timespec *abstime, |
---|
67 | Watchdog_Interval *ticks_out |
---|
68 | ); |
---|
69 | |
---|
70 | /** @} */ |
---|
71 | |
---|
72 | #endif |
---|