source: rtems/cpukit/posix/src/clockgettime.c @ 860c34e

4.104.114.95
Last change on this file since 860c34e was 1ee474ea, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/13/07 at 05:28:28

#ifdef CLOCK_MONOTONIC the CLOCK_MONOTONIC case.

  • Property mode set to 100644
File size: 928 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
19/*PAGE
20 *
21 *  14.2.1 Clocks, P1003.1b-1993, p. 263
22 */
23
24int clock_gettime(
25  clockid_t        clock_id,
26  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      _TOD_Get(tp);
36      break;
37
38#ifdef CLOCK_MONOTONIC
39    case CLOCK_MONOTONIC:
40      _TOD_Get_uptime(tp);
41      break;
42#endif
43
44#ifdef _POSIX_CPUTIME
45    case CLOCK_PROCESS_CPUTIME:
46      _TOD_Get_uptime(tp);
47      break;
48#endif
49
50#ifdef _POSIX_THREAD_CPUTIME
51    case CLOCK_THREAD_CPUTIME:
52      return POSIX_NOT_IMPLEMENTED();
53      break;
54#endif
55    default:
56      rtems_set_errno_and_return_minus_one( EINVAL );
57
58  }
59  return 0;
60}
Note: See TracBrowser for help on using the repository browser.