From 5a24a79a9ed43d9154273567b60e88b694924c4f Mon Sep 17 00:00:00 2001 From: mmitchel Date: Thu, 10 Mar 2005 00:57:10 +0000 Subject: * libiberty.h (gettimeofday): Declare. * configure.ac (funcs): Add gettimeofday. * configure: Regenerated. * gettimeofday.c: New file. * Makefile.in (CFILES): Add gettimeofday. (CONFIGURED_OFILES): Add gettimeofday.o. (./gettimeofday.o): New rule. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96230 138bc75d-0d04-0410-961f-82ee72b054a4 --- libiberty/gettimeofday.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 libiberty/gettimeofday.c (limited to 'libiberty/gettimeofday.c') diff --git a/libiberty/gettimeofday.c b/libiberty/gettimeofday.c new file mode 100644 index 00000000000..f7e6c5dd377 --- /dev/null +++ b/libiberty/gettimeofday.c @@ -0,0 +1,32 @@ +#include "config.h" +#include "libiberty.h" +#ifdef HAVE_TIME_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif + +/* + +@deftypefn int gettimeofday (struct timeval *@var{tp}, void *@var{tz}) + +Writes the current time to @var{tp}. This implementation requires +that @var{tz} be NULL. Returns 0 on success, -1 on failure. + +@end deftypefn + +*/ + +int +gettimeofday (tp, tz) + struct timeval *tp; + void *tz; +{ + if (tz) + abort (); + tp->tv_usec = 0; + if (time (&tp->tv_sec) == (time_t) -1) + return -1; + return 0; +} -- cgit v1.2.1