4.104.115
Last change
on this file since 92f4671 was
3d66dfc1,
checked in by Joel Sherrill <joel.sherrill@…>, on 12/16/08 at 17:36:01
|
2008-12-16 Joel Sherrill <joel.sherrill@…>
- libcsupport/src/times.c, posix/src/adjtime.c,
posix/src/clockgetres.c, posix/src/sysconf.c,
rtems/src/clockgettickspersecond.c, rtems/src/clockgettod.c,
rtems/src/clockset.c, rtems/src/clocktodvalidate.c,
score/src/timespecfromticks.c, score/src/timespectoticks.c,
score/src/ts64toticks.c: More case converted to use configuration
table entry not _TOD_Microseconds_per_tick.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /* |
---|
2 | * $Id$ |
---|
3 | */ |
---|
4 | |
---|
5 | /* |
---|
6 | * COPYRIGHT (c) 1989-2007. |
---|
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 | #if HAVE_CONFIG_H |
---|
17 | #include "config.h" |
---|
18 | #endif |
---|
19 | |
---|
20 | #include <time.h> |
---|
21 | #include <errno.h> |
---|
22 | |
---|
23 | #include <rtems/system.h> |
---|
24 | #include <rtems/config.h> |
---|
25 | #include <rtems/score/isr.h> |
---|
26 | #include <rtems/score/thread.h> |
---|
27 | #include <rtems/score/tod.h> |
---|
28 | |
---|
29 | #include <rtems/seterr.h> |
---|
30 | #include <rtems/posix/time.h> |
---|
31 | |
---|
32 | /*PAGE |
---|
33 | * |
---|
34 | * 14.2.1 Clocks, P1003.1b-1993, p. 263 |
---|
35 | */ |
---|
36 | |
---|
37 | int clock_getres( |
---|
38 | clockid_t clock_id, |
---|
39 | struct timespec *res |
---|
40 | ) |
---|
41 | { |
---|
42 | if ( !res ) |
---|
43 | rtems_set_errno_and_return_minus_one( EINVAL ); |
---|
44 | |
---|
45 | switch ( clock_id ) { |
---|
46 | |
---|
47 | /* |
---|
48 | * All time in rtems is based on the same clock tick. |
---|
49 | */ |
---|
50 | |
---|
51 | case CLOCK_REALTIME: |
---|
52 | case CLOCK_PROCESS_CPUTIME: |
---|
53 | case CLOCK_THREAD_CPUTIME: |
---|
54 | if ( res ) { |
---|
55 | res->tv_sec = rtems_configuration_get_microseconds_per_tick() / |
---|
56 | TOD_MICROSECONDS_PER_SECOND; |
---|
57 | res->tv_nsec = rtems_configuration_get_nanoseconds_per_tick(); |
---|
58 | } |
---|
59 | break; |
---|
60 | |
---|
61 | default: |
---|
62 | rtems_set_errno_and_return_minus_one( EINVAL ); |
---|
63 | |
---|
64 | } |
---|
65 | return 0; |
---|
66 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.