source: rtems/cpukit/posix/src/clocksettime.c @ fbfb5926

4.104.114.9
Last change on this file since fbfb5926 was fbfb5926, checked in by Joel Sherrill <joel.sherrill@…>, on Dec 13, 2007 at 4:52:21 PM

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.3 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_settime(
32  clockid_t              clock_id,
33  const 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      if ( tp->tv_sec < TOD_SECONDS_1970_THROUGH_1988 )
43        rtems_set_errno_and_return_minus_one( EINVAL );
44
45      _Thread_Disable_dispatch();
46        _TOD_Set( tp );
47      _Thread_Enable_dispatch();
48      break;
49
50#ifdef _POSIX_CPUTIME
51    case CLOCK_PROCESS_CPUTIME:
52      rtems_set_errno_and_return_minus_one( ENOSYS );
53      break;
54#endif
55
56#ifdef _POSIX_THREAD_CPUTIME
57    case CLOCK_THREAD_CPUTIME:
58      rtems_set_errno_and_return_minus_one( ENOSYS );
59      break;
60#endif
61    default:
62      rtems_set_errno_and_return_minus_one( EINVAL );
63
64  }
65  return 0;
66}
Note: See TracBrowser for help on using the repository browser.