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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [posix/] [src/] [clockgetres.c] - Blame information for rev 1026

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

Line No. Rev Author Line
1 1026 ivang
/*
2
 *  clockgetres.c,v 1.5 2002/01/04 18:28:24 joel Exp
3
 */
4
 
5
#if HAVE_CONFIG_H
6
#include "config.h"
7
#endif
8
 
9
#include <assert.h>
10
#include <time.h>
11
#include <errno.h>
12
 
13
#include <rtems/system.h>
14
#include <rtems/score/isr.h>
15
#include <rtems/score/thread.h>
16
#include <rtems/score/tod.h>
17
 
18
#include <rtems/seterr.h>
19
#include <rtems/posix/time.h>
20
 
21
/*PAGE
22
 *
23
 *  14.2.1 Clocks, P1003.1b-1993, p. 263
24
 */
25
 
26
int clock_getres(
27
  clockid_t        clock_id,
28
  struct timespec *res
29
)
30
{
31
  if ( !res )
32
    rtems_set_errno_and_return_minus_one( EINVAL );
33
 
34
  switch ( clock_id ) {
35
 
36
    /*
37
     *  All time in rtems is based on the same clock tick.
38
     */
39
 
40
    case CLOCK_REALTIME:
41
    case CLOCK_PROCESS_CPUTIME:
42
    case CLOCK_THREAD_CPUTIME:
43
      if ( res ) {
44
        res->tv_sec = _TOD_Microseconds_per_tick / 1000000;
45
        res->tv_nsec = _TOD_Microseconds_per_tick * 1000;
46
        /* _POSIX_Interval_to_timespec( _TOD_Microseconds_per_tick, res );  */
47
      }
48
      break;
49
 
50
    default:
51
      rtems_set_errno_and_return_minus_one( EINVAL );
52
 
53
  }
54
  return 0;
55
}

powered by: WebSVN 2.1.0

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