From 6fb8455249992d939e6a80f7414b3c48d82241bc Mon Sep 17 00:00:00 2001 From: jjohnstn Date: Mon, 22 Jul 2002 19:24:53 +0000 Subject: [PATCH] 2002-07-19 Aldy Hernandez * libc/machine/powerpc/time.c: New file. * libc/machine/powerpc/Makefile.am (lib_a_SOURCES): Add time.c. * libc/machine/powerpc/Makefile.in: Regenerated. --- newlib/ChangeLog | 8 ++++++++ newlib/libc/machine/powerpc/Makefile.am | 2 +- newlib/libc/machine/powerpc/Makefile.in | 4 ++-- newlib/libc/machine/powerpc/time.c | 36 +++++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 newlib/libc/machine/powerpc/time.c diff --git a/newlib/ChangeLog b/newlib/ChangeLog index b89fcd83c7..6d62683f64 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,10 @@ +2002-07-19 Aldy Hernandez + + * libc/machine/powerpc/time.c: New file. + * libc/machine/powerpc/Makefile.am (lib_a_SOURCES): Add + time.c. + * libc/machine/powerpc/Makefile.in: Regenerated. + 2002-07-22 Thomas Fitzsimmons * libc/libc.texinfo: Change copyright notices to Red Hat from @@ -6,6 +13,7 @@ * README: Change docs URL to http://sources.redhat.com/newlib/docs.html. +>>>>>>> 1.389 2002-07-19 Jeff Johnston * libc/sys/linux/Makefile.am: Add pathconf.c and fpathconf.c. diff --git a/newlib/libc/machine/powerpc/Makefile.am b/newlib/libc/machine/powerpc/Makefile.am index 4ddc19ac80..fd8a6530ae 100644 --- a/newlib/libc/machine/powerpc/Makefile.am +++ b/newlib/libc/machine/powerpc/Makefile.am @@ -6,7 +6,7 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) noinst_LIBRARIES = lib.a -lib_a_SOURCES = setjmp.S +lib_a_SOURCES = setjmp.S time.c lib_a_LIBADD = @extra_objs@ EXTRA_lib_a_SOURCES = @extra_sources@ lib_a_DEPENDENCIES = @extra_objs@ diff --git a/newlib/libc/machine/powerpc/Makefile.in b/newlib/libc/machine/powerpc/Makefile.in index 1a5b2e5129..0f1d7c8efe 100644 --- a/newlib/libc/machine/powerpc/Makefile.in +++ b/newlib/libc/machine/powerpc/Makefile.in @@ -91,7 +91,7 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) noinst_LIBRARIES = lib.a -lib_a_SOURCES = setjmp.S +lib_a_SOURCES = setjmp.S time.c lib_a_LIBADD = @extra_objs@ EXTRA_lib_a_SOURCES = @extra_sources@ lib_a_DEPENDENCIES = @extra_objs@ @@ -110,7 +110,7 @@ LIBRARIES = $(noinst_LIBRARIES) DEFS = @DEFS@ -I. -I$(srcdir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ -lib_a_OBJECTS = setjmp.o +lib_a_OBJECTS = setjmp.o time.o CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) diff --git a/newlib/libc/machine/powerpc/time.c b/newlib/libc/machine/powerpc/time.c new file mode 100644 index 0000000000..64f4ddcb8a --- /dev/null +++ b/newlib/libc/machine/powerpc/time.c @@ -0,0 +1,36 @@ +/* Time support routines for PowerPC. + * + * Written by Aldy Hernandez. + */ + +#include <_ansi.h> +#include +#include +#include +#include + +clock_t +times (struct tms *tp) +{ + struct rusage usage; + union { + struct rusage r; + /* Newlib's rusage has only 2 fields. We need to make room for + when we call the system's rusage. This should be enough. */ + int filler[32]; + } host_ru; + + getrusage (RUSAGE_SELF, (void *)&host_ru); + + if (tp) + { + tp->tms_utime = host_ru.r.ru_utime.tv_sec * 1000 + + host_ru.r.ru_utime.tv_usec; + tp->tms_stime = host_ru.r.ru_stime.tv_sec * 1000 + + host_ru.r.ru_stime.tv_usec; + tp->tms_cutime = 0; /* user time, children */ + tp->tms_cstime = 0; /* system time, children */ + } + + return tp->tms_utime; +} -- 2.11.0