summaryrefslogtreecommitdiff
path: root/libiberty/gettimeofday.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-10 00:57:10 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-10 00:57:10 +0000
commit5a24a79a9ed43d9154273567b60e88b694924c4f (patch)
treee1432758346a3d218242923db100c5546a76889e /libiberty/gettimeofday.c
parentb2026bdf67a3f498571a128bbb8a052c63b11866 (diff)
downloadgcc-5a24a79a9ed43d9154273567b60e88b694924c4f.tar.gz
* 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
Diffstat (limited to 'libiberty/gettimeofday.c')
-rw-r--r--libiberty/gettimeofday.c32
1 files changed, 32 insertions, 0 deletions
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 <time.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#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;
+}