mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 16:41:11 +02:00
moved windows-gettimeofday() from benchmark.c to n2n.c
This commit is contained in:
parent
0ab9f3229e
commit
252ce9779a
22
src/n2n.c
22
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
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user