This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

SH: implement time()


This patch, in addition to the just-installed patch in the SH sim,
introduce support for time() and gettimeofday() in the SH tool-chain.
Ok to install?

Index: newlib/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* configure.host (sh*-*-*): Add -DHAVE_GETTIMEOFDAY to newlib_cflags.
	* libc/sys/sh/syscalls.c (_gettimeofday_r): New.

Index: newlib/configure.host
===================================================================
RCS file: /cvs/src/src/newlib/configure.host,v
retrieving revision 1.9
diff -u -p -r1.9 configure.host
--- newlib/configure.host 2001/01/09 19:30:13 1.9
+++ newlib/configure.host 2001/01/24 13:45:32
@@ -429,6 +429,7 @@ case "${host}" in
 	syscall_dir=syscalls
 	;;
   sh*-*-*)
+	newlib_cflags="${newlib_cflags} -DHAVE_GETTIMEOFDAY"
 	syscall_dir=syscalls
 	;;
   sparc-sun-sunos*)
Index: newlib/libc/sys/sh/syscalls.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/sh/syscalls.c,v
retrieving revision 1.2
diff -u -p -r1.2 syscalls.c
--- newlib/libc/sys/sh/syscalls.c 2000/11/30 20:18:28 1.2
+++ newlib/libc/sys/sh/syscalls.c 2001/01/24 13:45:32
@@ -1,6 +1,7 @@
 #include <_ansi.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/time.h>
 #include "sys/syscall.h"
 int errno;
 
@@ -173,4 +174,12 @@ int
 _pipe (int *fd)
 {
   return __trap34 (SYS_pipe, fd);
+}
+
+int
+_gettimeofday (struct timeval *tv, struct timezone *tz)
+{
+  tv->tv_usec = 0;
+  tv->tv_sec = __trap34 (SYS_time);
+  return 0;
 }

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]