projects
/
platform
/
upstream
/
gcc.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
libiberty.h (gettimeofday): Declare.
[platform/upstream/gcc.git]
/
libiberty
/
gettimeofday.c
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
9
10
/*
11
12
@deftypefn int gettimeofday (struct timeval *@var{tp}, void *@var{tz})
13
14
Writes the current time to @var{tp}. This implementation requires
15
that @var{tz} be NULL. Returns 0 on success, -1 on failure.
16
17
@end deftypefn
18
19
*/
20
21
int
22
gettimeofday (tp, tz)
23
struct timeval *tp;
24
void *tz;
25
{
26
if (tz)
27
abort ();
28
tp->tv_usec = 0;
29
if (time (&tp->tv_sec) == (time_t) -1)
30
return -1;
31
return 0;
32
}