source: rtems/c/src/exec/posix/src/clockgetres.c @ 710b4e0

Last change on this file since 710b4e0 was 710b4e0, checked in by Joel Sherrill <joel.sherrill@…>, on Oct 10, 2001 at 6:37:02 PM

2001-09-28 Joel Sherrill <joel@…>

  • src/clockgetres.c: Fixed math 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: 956 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/posix/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.