source: rtems/cpukit/posix/src/clockgettime.c @ 920343e

4.104.114.95
Last change on this file since 920343e was fbfb5926, checked in by Joel Sherrill <joel.sherrill@…>, on 12/13/07 at 16:52:21

2007-12-13 Joel Sherrill <joel.sherrill@…>

  • posix/Makefile.am, posix/src/clockgetcpuclockid.c, posix/src/clockgetenableattr.c, posix/src/clockgettime.c, posix/src/clocksetenableattr.c, posix/src/clocksettime.c, posix/src/devctl.c, posix/src/execl.c, posix/src/execle.c, posix/src/execlp.c, posix/src/execv.c, posix/src/execve.c, posix/src/execvp.c, posix/src/fork.c, posix/src/mutexinit.c, posix/src/pthreadatfork.c, posix/src/pthreadgetcpuclockid.c, posix/src/pthreadkill.c, posix/src/semaphorecreatesupp.c, posix/src/sysconf.c, posix/src/wait.c, posix/src/waitpid.c: Split files into one function per file.
  • posix/src/aio_cancel.c, posix/src/aio_error.c, posix/src/aio_fsync.c, posix/src/aio_read.c, posix/src/aio_return.c, posix/src/aio_suspend.c, posix/src/aio_write.c, posix/src/lio_listio.c, posix/src/sched_getparam.c, posix/src/sched_getprioritymax.c, posix/src/sched_getprioritymin.c, posix/src/sched_getscheduler.c, posix/src/sched_rr_get_interval.c, posix/src/sched_setparam.c, posix/src/sched_setscheduler.c, posix/src/sched_yield.c: New files.
  • posix/src/aio.c, posix/src/sched.c, posix/src/types.c: Removed.
  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2007.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <time.h>
17#include <errno.h>
18
19#include <rtems/system.h>
20#include <rtems/score/isr.h>
21#include <rtems/score/thread.h>
22#include <rtems/score/tod.h>
23
24#include <rtems/seterr.h>
25
26/*PAGE
27 *
28 *  14.2.1 Clocks, P1003.1b-1993, p. 263
29 */
30
31int clock_gettime(
32  clockid_t        clock_id,
33  struct timespec *tp
34)
35{
36  if ( !tp )
37    rtems_set_errno_and_return_minus_one( EINVAL );
38
39  switch ( clock_id ) {
40
41    case CLOCK_REALTIME:
42      _TOD_Get(tp);
43      break;
44
45#ifdef CLOCK_MONOTONIC
46    case CLOCK_MONOTONIC:
47      _TOD_Get_uptime(tp);
48      break;
49#endif
50
51#ifdef _POSIX_CPUTIME
52    case CLOCK_PROCESS_CPUTIME:
53      _TOD_Get_uptime(tp);
54      break;
55#endif
56
57#ifdef _POSIX_THREAD_CPUTIME
58    case CLOCK_THREAD_CPUTIME:
59      rtems_set_errno_and_return_minus_one( ENOSYS );
60      break;
61#endif
62    default:
63      rtems_set_errno_and_return_minus_one( EINVAL );
64
65  }
66  return 0;
67}
Note: See TracBrowser for help on using the repository browser.