Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4973 | right-hear | 1 | /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
2 | #include |
||
3 | #include |
||
4 | #include |
||
5 | #include |
||
6 | |||
7 | int getrusage(int _who, struct rusage *_rusage) |
||
8 | { |
||
9 | clock_t q; |
||
10 | if (_rusage == 0) |
||
11 | { |
||
12 | errno = EFAULT; |
||
13 | return -1; |
||
14 | } |
||
15 | if (_who != RUSAGE_SELF && _who != RUSAGE_CHILDREN) |
||
16 | { |
||
17 | errno = EINVAL; |
||
18 | return -1; |
||
19 | } |
||
20 | memset(_rusage, 0, sizeof(struct rusage)); |
||
21 | q = clock(); |
||
22 | _rusage->ru_utime.tv_sec = q / CLOCKS_PER_SEC; |
||
23 | _rusage->ru_utime.tv_usec = q % CLOCKS_PER_SEC * 1000000 / CLOCKS_PER_SEC; |
||
24 | return 0; |
||
25 | } |