OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [posix/] [src/] [clockgetres.c] - Blame information for rev 593

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  $Id: clockgetres.c,v 1.2 2001-09-27 11:59:17 chris Exp $
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
 
22
int 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
        _POSIX_Interval_to_timespec( _TOD_Microseconds_per_tick, res );
41
      break;
42
 
43
    default:
44
      set_errno_and_return_minus_one( EINVAL );
45
 
46
  }
47
  return 0;
48
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.