diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-10 00:57:10 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-10 00:57:10 +0000 |
commit | 5a24a79a9ed43d9154273567b60e88b694924c4f (patch) | |
tree | e1432758346a3d218242923db100c5546a76889e /libiberty/gettimeofday.c | |
parent | b2026bdf67a3f498571a128bbb8a052c63b11866 (diff) | |
download | gcc-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.c | 32 |
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; +} |