diff --git a/src/n2n.c b/src/n2n.c index 7d57cf6..2390a37 100644 --- a/src/n2n.c +++ b/src/n2n.c @@ -377,3 +377,25 @@ int sock_equal(const n2n_sock_t * a, return(1); } +/* *********************************************** */ + +#if defined(WIN32) && !defined(__GNUC__) +static int gettimeofday(struct timeval *tp, void *tzp) +{ + time_t clock; + struct tm tm; + SYSTEMTIME wtm; + GetLocalTime(&wtm); + tm.tm_year = wtm.wYear - 1900; + tm.tm_mon = wtm.wMonth - 1; + tm.tm_mday = wtm.wDay; + tm.tm_hour = wtm.wHour; + tm.tm_min = wtm.wMinute; + tm.tm_sec = wtm.wSecond; + tm.tm_isdst = -1; + clock = mktime(&tm); + tp->tv_sec = clock; + tp->tv_usec = wtm.wMilliseconds * 1000; + return (0); +} +#endif diff --git a/tools/benchmark.c b/tools/benchmark.c index 671b639..e1d3644 100644 --- a/tools/benchmark.c +++ b/tools/benchmark.c @@ -18,26 +18,6 @@ #include "n2n.h" -#if defined(WIN32) && !defined(__GNUC__) -static int gettimeofday(struct timeval *tp, void *tzp) -{ - time_t clock; - struct tm tm; - SYSTEMTIME wtm; - GetLocalTime(&wtm); - tm.tm_year = wtm.wYear - 1900; - tm.tm_mon = wtm.wMonth - 1; - tm.tm_mday = wtm.wDay; - tm.tm_hour = wtm.wHour; - tm.tm_min = wtm.wMinute; - tm.tm_sec = wtm.wSecond; - tm.tm_isdst = -1; - clock = mktime(&tm); - tp->tv_sec = clock; - tp->tv_usec = wtm.wMilliseconds * 1000; - return (0); -} -#endif uint8_t PKT_CONTENT[]={ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,