libiberty.h (gettimeofday): Declare.
* 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. From-SVN: r96230
This commit is contained in:
parent
1569224588
commit
17049f0bbb
@ -1,3 +1,7 @@
|
|||||||
|
2005-03-09 Mark Mitchell <mark@codesourcery.com>
|
||||||
|
|
||||||
|
* libiberty.h (gettimeofday): Declare.
|
||||||
|
|
||||||
2005-03-01 Jan Beulich <jbeulich@novell.com>
|
2005-03-01 Jan Beulich <jbeulich@novell.com>
|
||||||
|
|
||||||
* libiberty.h: Declare unlink_if_ordinary.
|
* libiberty.h: Declare unlink_if_ordinary.
|
||||||
|
@ -145,6 +145,15 @@ extern int fdmatch PARAMS ((int fd1, int fd2));
|
|||||||
|
|
||||||
extern char * getpwd PARAMS ((void));
|
extern char * getpwd PARAMS ((void));
|
||||||
|
|
||||||
|
/* Get the current time. */
|
||||||
|
/* Prototypes vary from system to system, so we only provide a
|
||||||
|
prototype on systems where we know that we need it. */
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
/* Forward declaration to avoid #include <sys/time.h>. */
|
||||||
|
struct timeval;
|
||||||
|
extern int gettimeofday PARAMS ((struct timeval *, void *));
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Get the amount of time the process has run, in microseconds. */
|
/* Get the amount of time the process has run, in microseconds. */
|
||||||
|
|
||||||
extern long get_run_time PARAMS ((void));
|
extern long get_run_time PARAMS ((void));
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2005-03-09 Mark Mitchell <mark@codesourcery.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2005-03-09 Ian Lance Taylor <ian@airs.com>
|
2005-03-09 Ian Lance Taylor <ian@airs.com>
|
||||||
|
|
||||||
* pex-os2.c: Remove.
|
* pex-os2.c: Remove.
|
||||||
|
@ -133,6 +133,7 @@ CFILES = alloca.c argv.c asprintf.c atexit.c \
|
|||||||
dyn-string.c \
|
dyn-string.c \
|
||||||
fdmatch.c ffs.c fibheap.c floatformat.c fnmatch.c \
|
fdmatch.c ffs.c fibheap.c floatformat.c fnmatch.c \
|
||||||
getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \
|
getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \
|
||||||
|
gettimeofday.c \
|
||||||
hashtab.c hex.c \
|
hashtab.c hex.c \
|
||||||
index.c insque.c \
|
index.c insque.c \
|
||||||
lbasename.c \
|
lbasename.c \
|
||||||
@ -184,7 +185,7 @@ CONFIGURED_OFILES = ./asprintf.o ./atexit.o \
|
|||||||
./calloc.o ./clock.o ./copysign.o \
|
./calloc.o ./clock.o ./copysign.o \
|
||||||
./_doprnt.o \
|
./_doprnt.o \
|
||||||
./ffs.o \
|
./ffs.o \
|
||||||
./getcwd.o ./getpagesize.o \
|
./getcwd.o ./getpagesize.o ./gettimeofday.o \
|
||||||
./index.o ./insque.o \
|
./index.o ./insque.o \
|
||||||
./memchr.o ./memcmp.o ./memcpy.o ./memmove.o ./mempcpy.o \
|
./memchr.o ./memcmp.o ./memcpy.o ./memmove.o ./mempcpy.o \
|
||||||
./memset.o ./mkstemps.o \
|
./memset.o ./mkstemps.o \
|
||||||
@ -415,6 +416,10 @@ maintainer-clean-subdir: config.h
|
|||||||
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS): stamp-picdir
|
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS): stamp-picdir
|
||||||
$(CONFIGURED_OFILES): stamp-picdir
|
$(CONFIGURED_OFILES): stamp-picdir
|
||||||
|
|
||||||
|
# Don't export variables to the environment, in order to not confuse
|
||||||
|
# configure.
|
||||||
|
.NOEXPORT:
|
||||||
|
|
||||||
# The dependencies in the remainder of this file are automatically
|
# The dependencies in the remainder of this file are automatically
|
||||||
# generated by "make maint-deps". Manual edits will be lost.
|
# generated by "make maint-deps". Manual edits will be lost.
|
||||||
|
|
||||||
@ -615,6 +620,13 @@ $(CONFIGURED_OFILES): stamp-picdir
|
|||||||
else true; fi
|
else true; fi
|
||||||
$(COMPILE.c) $(srcdir)/getruntime.c $(OUTPUT_OPTION)
|
$(COMPILE.c) $(srcdir)/getruntime.c $(OUTPUT_OPTION)
|
||||||
|
|
||||||
|
./gettimeofday.o: $(srcdir)/gettimeofday.c config.h $(INCDIR)/ansidecl.h \
|
||||||
|
$(INCDIR)/libiberty.h
|
||||||
|
if [ x"$(PICFLAG)" != x ]; then \
|
||||||
|
$(COMPILE.c) $(PICFLAG) $(srcdir)/gettimeofday.c -o pic/$@; \
|
||||||
|
else true; fi
|
||||||
|
$(COMPILE.c) $(srcdir)/gettimeofday.c $(OUTPUT_OPTION)
|
||||||
|
|
||||||
./hashtab.o: $(srcdir)/hashtab.c config.h $(INCDIR)/ansidecl.h \
|
./hashtab.o: $(srcdir)/hashtab.c config.h $(INCDIR)/ansidecl.h \
|
||||||
$(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
|
$(INCDIR)/hashtab.h $(INCDIR)/libiberty.h
|
||||||
if [ x"$(PICFLAG)" != x ]; then \
|
if [ x"$(PICFLAG)" != x ]; then \
|
||||||
@ -955,8 +967,8 @@ $(CONFIGURED_OFILES): stamp-picdir
|
|||||||
else true; fi
|
else true; fi
|
||||||
$(COMPILE.c) $(srcdir)/tmpnam.c $(OUTPUT_OPTION)
|
$(COMPILE.c) $(srcdir)/tmpnam.c $(OUTPUT_OPTION)
|
||||||
|
|
||||||
./unlink-if-ordinary.o: $(srcdir)/unlink-if-ordinary.c config.h $(INCDIR)/ansidecl.h \
|
./unlink-if-ordinary.o: $(srcdir)/unlink-if-ordinary.c config.h \
|
||||||
$(INCDIR)/libiberty.h
|
$(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
|
||||||
if [ x"$(PICFLAG)" != x ]; then \
|
if [ x"$(PICFLAG)" != x ]; then \
|
||||||
$(COMPILE.c) $(PICFLAG) $(srcdir)/unlink-if-ordinary.c -o pic/$@; \
|
$(COMPILE.c) $(PICFLAG) $(srcdir)/unlink-if-ordinary.c -o pic/$@; \
|
||||||
else true; fi
|
else true; fi
|
||||||
@ -1046,6 +1058,3 @@ $(CONFIGURED_OFILES): stamp-picdir
|
|||||||
else true; fi
|
else true; fi
|
||||||
$(COMPILE.c) $(srcdir)/xstrerror.c $(OUTPUT_OPTION)
|
$(COMPILE.c) $(srcdir)/xstrerror.c $(OUTPUT_OPTION)
|
||||||
|
|
||||||
# Don't export variables to the environment, in order to not confuse
|
|
||||||
# configure.
|
|
||||||
.NOEXPORT:
|
|
||||||
|
@ -225,6 +225,7 @@ funcs="$funcs clock"
|
|||||||
funcs="$funcs ffs"
|
funcs="$funcs ffs"
|
||||||
funcs="$funcs getcwd"
|
funcs="$funcs getcwd"
|
||||||
funcs="$funcs getpagesize"
|
funcs="$funcs getpagesize"
|
||||||
|
funcs="$funcs gettimeofday"
|
||||||
funcs="$funcs index"
|
funcs="$funcs index"
|
||||||
funcs="$funcs insque"
|
funcs="$funcs insque"
|
||||||
funcs="$funcs memchr"
|
funcs="$funcs memchr"
|
||||||
@ -272,7 +273,7 @@ checkfuncs="$checkfuncs getsysinfo table sysctl"
|
|||||||
# autoheader happy without adding a bunch of text to acconfig.h.
|
# autoheader happy without adding a bunch of text to acconfig.h.
|
||||||
if test "x" = "y"; then
|
if test "x" = "y"; then
|
||||||
AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bsearch bzero calloc clock \
|
AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bsearch bzero calloc clock \
|
||||||
getcwd getpagesize index insque mkstemps memchr memcmp memcpy \
|
getcwd getpagesize gettimeofday index insque mkstemps memchr memcmp memcpy \
|
||||||
memmove mempcpy memset putenv random rename rindex sigsetmask \
|
memmove mempcpy memset putenv random rename rindex sigsetmask \
|
||||||
strcasecmp setenv stpcpy stpncpy strchr strdup strncasecmp strrchr strstr \
|
strcasecmp setenv stpcpy stpncpy strchr strdup strncasecmp strrchr strstr \
|
||||||
strtod strtol strtoul tmpnam vasprintf vfprintf vprintf \
|
strtod strtol strtoul tmpnam vasprintf vfprintf vprintf \
|
||||||
|
32
libiberty/gettimeofday.c
Normal file
32
libiberty/gettimeofday.c
Normal file
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user