kopia lustrzana https://github.com/Hamlib/Hamlib
gettimeofday replacement for WIN32
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1509 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.0
rodzic
4e483641c2
commit
0dced917ad
|
@ -131,10 +131,10 @@ AC_SUBST(MATH_LIBS)
|
||||||
AC_CHECK_LIB(syslog,syslog) # OS/2 needs this
|
AC_CHECK_LIB(syslog,syslog) # OS/2 needs this
|
||||||
|
|
||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
AC_CHECK_FUNCS([atexit snprintf select gettimeofday memmove memset])
|
AC_CHECK_FUNCS([atexit snprintf select memmove memset])
|
||||||
AC_CHECK_FUNCS([strcasecmp strchr strdup strerror strrchr strstr strtol])
|
AC_CHECK_FUNCS([strcasecmp strchr strdup strerror strrchr strstr strtol])
|
||||||
AC_CHECK_FUNCS([cfmakeraw setitimer])
|
AC_CHECK_FUNCS([cfmakeraw setitimer])
|
||||||
AC_REPLACE_FUNCS([getopt_long usleep])
|
AC_REPLACE_FUNCS([getopt_long usleep gettimeofday])
|
||||||
AC_FUNC_ALLOCA
|
AC_FUNC_ALLOCA
|
||||||
#AC_FUNC_MALLOC
|
#AC_FUNC_MALLOC
|
||||||
AC_FUNC_VPRINTF
|
AC_FUNC_VPRINTF
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
EXTRA_DIST = getopt.c getopt.h getopt_long.c usleep.c \
|
EXTRA_DIST = getopt.c getopt.h getopt_long.c usleep.c \
|
||||||
termios.c win32termios.h
|
termios.c win32termios.h gettimeofday.c
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libmisc.la
|
noinst_LTLIBRARIES = libmisc.la
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_WINDOWS_H
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_WINBASE_H
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#ifndef timezone
|
||||||
|
struct timezone {
|
||||||
|
int tz_minuteswest;
|
||||||
|
int tz_dsttime;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* broken implementation for WIN32.
|
||||||
|
* FIXME: usec precision
|
||||||
|
*/
|
||||||
|
int gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||||
|
{
|
||||||
|
if (tv) {
|
||||||
|
time_t tm;
|
||||||
|
|
||||||
|
time(&tm);
|
||||||
|
tv->tv_sec = tm;
|
||||||
|
tv->tv_usec = 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue