Back to index

cell-binutils  2.17cvs20070401
gettimeofday.c
Go to the documentation of this file.
00001 #include "config.h"
00002 #include "libiberty.h"
00003 #ifdef HAVE_TIME_H
00004 #include <time.h>
00005 #endif
00006 #ifdef HAVE_SYS_TIME_H
00007 #include <sys/time.h>
00008 #endif
00009 
00010 /* 
00011 
00012 @deftypefn Supplemental int gettimeofday (struct timeval *@var{tp}, void *@var{tz})
00013 
00014 Writes the current time to @var{tp}.  This implementation requires
00015 that @var{tz} be NULL.  Returns 0 on success, -1 on failure.
00016 
00017 @end deftypefn
00018 
00019 */ 
00020 
00021 int
00022 gettimeofday (struct timeval *tp, void *tz)
00023 {
00024   if (tz)
00025     abort ();
00026   tp->tv_usec = 0;
00027   if (time (&tp->tv_sec) == (time_t) -1)
00028     return -1;
00029   return 0;
00030 }