4.104.114.95
Line | |
---|
1 | /* |
---|
2 | * $Id$ |
---|
3 | */ |
---|
4 | |
---|
5 | #if HAVE_CONFIG_H |
---|
6 | #include "config.h" |
---|
7 | #endif |
---|
8 | |
---|
9 | #include <time.h> |
---|
10 | #include <errno.h> |
---|
11 | |
---|
12 | #include <rtems/system.h> |
---|
13 | #include <rtems/score/isr.h> |
---|
14 | #include <rtems/score/thread.h> |
---|
15 | #include <rtems/score/tod.h> |
---|
16 | |
---|
17 | #include <rtems/seterr.h> |
---|
18 | |
---|
19 | /*PAGE |
---|
20 | * |
---|
21 | * 14.2.1 Clocks, P1003.1b-1993, p. 263 |
---|
22 | */ |
---|
23 | |
---|
24 | int clock_settime( |
---|
25 | clockid_t clock_id, |
---|
26 | const struct timespec *tp |
---|
27 | ) |
---|
28 | { |
---|
29 | if ( !tp ) |
---|
30 | rtems_set_errno_and_return_minus_one( EINVAL ); |
---|
31 | |
---|
32 | switch ( clock_id ) { |
---|
33 | |
---|
34 | case CLOCK_REALTIME: |
---|
35 | if ( tp->tv_sec < TOD_SECONDS_1970_THROUGH_1988 ) |
---|
36 | rtems_set_errno_and_return_minus_one( EINVAL ); |
---|
37 | |
---|
38 | _Thread_Disable_dispatch(); |
---|
39 | _TOD_Set( tp ); |
---|
40 | _Thread_Enable_dispatch(); |
---|
41 | break; |
---|
42 | |
---|
43 | #ifdef _POSIX_CPUTIME |
---|
44 | case CLOCK_PROCESS_CPUTIME: |
---|
45 | return POSIX_NOT_IMPLEMENTED(); |
---|
46 | break; |
---|
47 | #endif |
---|
48 | |
---|
49 | #ifdef _POSIX_THREAD_CPUTIME |
---|
50 | case CLOCK_THREAD_CPUTIME: |
---|
51 | return POSIX_NOT_IMPLEMENTED(); |
---|
52 | break; |
---|
53 | #endif |
---|
54 | default: |
---|
55 | rtems_set_errno_and_return_minus_one( EINVAL ); |
---|
56 | |
---|
57 | } |
---|
58 | return 0; |
---|
59 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.