Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2002-07-22 23:24:53 +0400
committerJeff Johnston <jjohnstn@redhat.com>2002-07-22 23:24:53 +0400
commite964bca8a89c2556bb4e152843e130da063f74f8 (patch)
tree19e9d9aabec3562a0b80cbdf757995f1d3fdedb2 /newlib/libc/machine/powerpc
parent5e7d0a5510c83685271168b990af0757e7daeefb (diff)
2002-07-19 Aldy Hernandez <aldyh@redhat.com>
* libc/machine/powerpc/time.c: New file. * libc/machine/powerpc/Makefile.am (lib_a_SOURCES): Add time.c. * libc/machine/powerpc/Makefile.in: Regenerated.
Diffstat (limited to 'newlib/libc/machine/powerpc')
-rw-r--r--newlib/libc/machine/powerpc/Makefile.am2
-rw-r--r--newlib/libc/machine/powerpc/Makefile.in4
-rw-r--r--newlib/libc/machine/powerpc/time.c36
3 files changed, 39 insertions, 3 deletions
diff --git a/newlib/libc/machine/powerpc/Makefile.am b/newlib/libc/machine/powerpc/Makefile.am
index 4ddc19ac8..fd8a6530a 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 1a5b2e512..0f1d7c8ef 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 000000000..64f4ddcb8
--- /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 <reent.h>
+#include <sys/time.h>
+#include <sys/times.h>
+#include <sys/resource.h>
+
+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;
+}