source: rtems/cpukit/libcsupport/src/__times.c @ ac7d5ef0

4.104.114.84.95
Last change on this file since ac7d5ef0 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 *  RTEMS _times Implementation
3 *
4 *
5 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
6 *  On-Line Applications Research Corporation (OAR).
7 *  All rights assigned to U.S. Government, 1994.
8 *
9 *  This material may be reproduced by or for the U.S. Government pursuant
10 *  to the copyright license under the clause at DFARS 252.227-7013.  This
11 *  notice must appear in all copies of this file and its derivatives.
12 *
13 *  $Id$
14 */
15
16#include <rtems.h>
17
18#include <sys/times.h>
19#include <time.h>
20#include <sys/time.h>
21#include <errno.h>
22#include <assert.h>
23
24clock_t _times(
25   struct tms  *ptms
26)
27{
28  rtems_status_code      status;
29  rtems_interval         ticks_since_boot;
30
31  if ( !ptms ) {
32    errno = EFAULT;
33    return -1;
34  }
35
36  /* "POSIX" does not seem to allow for not having a TOD */
37  status = rtems_clock_get(
38    RTEMS_CLOCK_GET_TICKS_SINCE_BOOT,
39    &ticks_since_boot
40  );
41  if ( status != RTEMS_SUCCESSFUL ) {
42    assert( 0 );
43    return -1;
44  }
45
46  /*
47   *  RTEMS has no notion of system versus user time and does
48   *  not (as of 3.2.0) keep track of CPU usage on a per task basis.
49   */
50
51  ptms->tms_utime  = ticks_since_boot;
52  ptms->tms_stime  = 0;
53  ptms->tms_cutime = 0;
54  ptms->tms_cstime = 0;
55
56  return 0;
57}
58
59clock_t times(
60   struct tms  *ptms
61)
62{
63  return _times( ptms );
64}
65
Note: See TracBrowser for help on using the repository browser.