source: rtems/c/src/exec/posix/src/clockgetres.c @ a93baa43

4.104.114.84.95
Last change on this file since a93baa43 was a93baa43, checked in by Joel Sherrill <joel.sherrill@…>, on 01/22/01 at 14:19:05

2001-01-12 Joel Sherrill <joel@…>

  • src/clockgetres.c: Fixed match problem. We are not converting an interval to a timespec -- it is actually a real number of microseconds.
  • Property mode set to 100644
File size: 950 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        res->tv_sec = _TOD_Microseconds_per_tick / 1000000;
41        res->tv_nsec = _TOD_Microseconds_per_tick * 1000;
42        /* _POSIX_Interval_to_timespec( _TOD_Microseconds_per_tick, res );  */
43      }
44      break;
45 
46    default:
47      set_errno_and_return_minus_one( EINVAL );
48 
49  }
50  return 0;
51}
Note: See TracBrowser for help on using the repository browser.