testsuite: skip confirmation in 'gdb_reinitialize_dir'
[binutils-gdb.git] / libiberty / gettimeofday.c
blobfca16794028e254c48a4341b5455f8658c7a3e23
1 #include "config.h"
2 #include "libiberty.h"
3 #ifdef HAVE_TIME_H
4 #include <time.h>
5 #endif
6 #ifdef HAVE_SYS_TIME_H
7 #include <sys/time.h>
8 #endif
10 /*
12 @deftypefn Supplemental int gettimeofday (struct timeval *@var{tp}, void *@var{tz})
14 Writes the current time to @var{tp}. This implementation requires
15 that @var{tz} be NULL. Returns 0 on success, -1 on failure.
17 @end deftypefn
19 */
21 int
22 gettimeofday (struct timeval *tp, void *tz)
24 if (tz)
25 abort ();
26 tp->tv_usec = 0;
27 if (time (&tp->tv_sec) == (time_t) -1)
28 return -1;
29 return 0;