fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libc / machine / powerpc / times.c
blob64f4ddcb8af0406f3832d4c85c05294a53f9e5e9
1 /* Time support routines for PowerPC.
3 * Written by Aldy Hernandez.
4 */
6 #include <_ansi.h>
7 #include <reent.h>
8 #include <sys/time.h>
9 #include <sys/times.h>
10 #include <sys/resource.h>
12 clock_t
13 times (struct tms *tp)
15 struct rusage usage;
16 union {
17 struct rusage r;
18 /* Newlib's rusage has only 2 fields. We need to make room for
19 when we call the system's rusage. This should be enough. */
20 int filler[32];
21 } host_ru;
23 getrusage (RUSAGE_SELF, (void *)&host_ru);
25 if (tp)
27 tp->tms_utime = host_ru.r.ru_utime.tv_sec * 1000
28 + host_ru.r.ru_utime.tv_usec;
29 tp->tms_stime = host_ru.r.ru_stime.tv_sec * 1000
30 + host_ru.r.ru_stime.tv_usec;
31 tp->tms_cutime = 0; /* user time, children */
32 tp->tms_cstime = 0; /* system time, children */
35 return tp->tms_utime;