source: rtems/cpukit/posix/src/clockgetres.c @ 188c82b

4.104.114.84.95
Last change on this file since 188c82b was 188c82b, checked in by Joel Sherrill <joel.sherrill@…>, on 08/30/00 at 17:12:55

2000-08-30 Joel Sherrill <joel@…>

  • Many files: Moved posix/include/rtems/posix/seterr.h to score/include/rtems/seterr.h so it would be available within all APIs.
  • Property mode set to 100644
File size: 816 bytes
Line 
1/*
2 *  $Id$
3 */
4
5#include <assert.h>
6#include <time.h>
7#include <errno.h>
8
9#include <rtems/system.h>
10#include <rtems/score/isr.h>
11#include <rtems/score/thread.h>
12#include <rtems/score/tod.h>
13
14#include <rtems/seterr.h>
15#include <rtems/posix/time.h>
16
17/*PAGE
18 *
19 *  14.2.1 Clocks, P1003.1b-1993, p. 263
20 */
21
22int clock_getres(
23  clockid_t        clock_id,
24  struct timespec *res
25)
26{
27  if ( !res )
28    set_errno_and_return_minus_one( EINVAL );
29 
30  switch ( clock_id ) {
31 
32    /*
33     *  All time in rtems is based on the same clock tick.
34     */
35
36    case CLOCK_REALTIME:
37    case CLOCK_PROCESS_CPUTIME:
38    case CLOCK_THREAD_CPUTIME:
39      if ( res )
40        _POSIX_Interval_to_timespec( _TOD_Microseconds_per_tick, res );
41      break;
42 
43    default:
44      set_errno_and_return_minus_one( EINVAL );
45 
46  }
47  return 0;
48}
Note: See TracBrowser for help on using the repository browser.