4.115
Last change
on this file since 5cb175bb was
5cb175bb,
checked in by Joel Sherrill <joel.sherrill@…>, on 01/10/13 at 19:22:31
|
cpukit/posix: Doxygen group is POSIXAPI
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Function Returns the Resolution of any Clock |
---|
5 | * @ingroup POSIXAPI |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2007. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <time.h> |
---|
22 | #include <errno.h> |
---|
23 | |
---|
24 | #include <rtems/system.h> |
---|
25 | #include <rtems/config.h> |
---|
26 | #include <rtems/score/isr.h> |
---|
27 | #include <rtems/score/thread.h> |
---|
28 | #include <rtems/score/tod.h> |
---|
29 | |
---|
30 | #include <rtems/seterr.h> |
---|
31 | |
---|
32 | /* |
---|
33 | * 14.2.1 Clocks, P1003.1b-1993, p. 263 |
---|
34 | */ |
---|
35 | |
---|
36 | int clock_getres( |
---|
37 | clockid_t clock_id, |
---|
38 | struct timespec *res |
---|
39 | ) |
---|
40 | { |
---|
41 | if ( !res ) |
---|
42 | rtems_set_errno_and_return_minus_one( EINVAL ); |
---|
43 | |
---|
44 | switch ( clock_id ) { |
---|
45 | |
---|
46 | /* |
---|
47 | * All time in rtems is based on the same clock tick. |
---|
48 | */ |
---|
49 | |
---|
50 | case CLOCK_REALTIME: |
---|
51 | case CLOCK_PROCESS_CPUTIME_ID: |
---|
52 | case CLOCK_THREAD_CPUTIME_ID: |
---|
53 | if ( res ) { |
---|
54 | res->tv_sec = rtems_configuration_get_microseconds_per_tick() / |
---|
55 | TOD_MICROSECONDS_PER_SECOND; |
---|
56 | res->tv_nsec = rtems_configuration_get_nanoseconds_per_tick(); |
---|
57 | } |
---|
58 | break; |
---|
59 | |
---|
60 | default: |
---|
61 | rtems_set_errno_and_return_minus_one( EINVAL ); |
---|
62 | |
---|
63 | } |
---|
64 | return 0; |
---|
65 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.