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