source: rtems/cpukit/posix/src/clockgetres.c @ 0061ef98

4.104.114.84.9
Last change on this file since 0061ef98 was 0061ef98, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 26, 2007 at 10:56:12 PM

2007-03-26 Joel Sherrill <joel@…>

PR 1231/cpukit

  • posix/src/adasupp.c, posix/src/clockgetcpuclockid.c, posix/src/clockgetenableattr.c, posix/src/clockgetres.c, posix/src/clockgettime.c, posix/src/clocksetenableattr.c, posix/src/mutex.c, posix/src/mutexattrdestroy.c, posix/src/mutexattrgetprioceiling.c, posix/src/mutexattrgetprotocol.c, posix/src/mutexattrgetpshared.c, posix/src/mutexattrinit.c, posix/src/mutexattrsetprioceiling.c, posix/src/mutexattrsetprotocol.c, posix/src/mutexattrsetpshared.c, posix/src/mutexdefaultattributes.c, posix/src/mutexdestroy.c, posix/src/mutexgetprioceiling.c, posix/src/mutexlock.c, posix/src/mutexlocksupp.c, posix/src/mutexmp.c, posix/src/mutexsetprioceiling.c, posix/src/mutextimedlock.c, posix/src/mutextrylock.c, posix/src/mutexunlock.c, posix/src/nanosleep.c, posix/src/posixintervaltotimespec.c, posix/src/posixtimespecsubtract.c, posix/src/posixtimespectointerval.c, posix/src/psignalclearprocesssignals.c, posix/src/psignalclearsignals.c, posix/src/psignalsetprocesssignals.c, posix/src/psignalunblockthread.c, posix/src/ptimer.c, posix/src/ptimer1.c, posix/src/sched.c, posix/src/time.c: Remove unneeded includes of assert.h
  • Property mode set to 100644
File size: 984 bytes
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#include <rtems/posix/time.h>
19
20/*PAGE
21 *
22 *  14.2.1 Clocks, P1003.1b-1993, p. 263
23 */
24
25int clock_getres(
26  clockid_t        clock_id,
27  struct timespec *res
28)
29{
30  if ( !res )
31    rtems_set_errno_and_return_minus_one( EINVAL );
32
33  switch ( clock_id ) {
34
35    /*
36     *  All time in rtems is based on the same clock tick.
37     */
38
39    case CLOCK_REALTIME:
40    case CLOCK_PROCESS_CPUTIME:
41    case CLOCK_THREAD_CPUTIME:
42      if ( res ) {
43        res->tv_sec = _TOD_Microseconds_per_tick / 1000000;
44        res->tv_nsec = _TOD_Microseconds_per_tick * 1000;
45        /* _POSIX_Interval_to_timespec( _TOD_Microseconds_per_tick, res );  */
46      }
47      break;
48
49    default:
50      rtems_set_errno_and_return_minus_one( EINVAL );
51
52  }
53  return 0;
54}
Note: See TracBrowser for help on using the repository browser.