mirror of
https://github.com/ep00ch/lwip-contrib-mac.git
synced 2024-06-02 10:41:29 +00:00
Added files to compile check 0.9.8 under win32 (no fork support, of course)
This commit is contained in:
parent
015165df14
commit
0f5c7fa169
12
ports/win32/check/config.h
Normal file
12
ports/win32/check/config.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* config.h for check-0.9.8 on win32 under MSVC */
|
||||
|
||||
typedef unsigned int pid_t;
|
||||
typedef unsigned int uint32_t;
|
||||
|
||||
#define ssize_t size_t
|
||||
#define snprintf _snprintf
|
||||
|
||||
#define HAVE_DECL_STRDUP 1
|
||||
#define HAVE_DECL_FILENO 1
|
||||
|
||||
#include <io.h>
|
12
ports/win32/check/sys/time.h
Normal file
12
ports/win32/check/sys/time.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#ifndef __SYS__TIME_H__
|
||||
#define __SYS__TIME_H__
|
||||
|
||||
#include <stdlib.h> /* time_t */
|
||||
|
||||
struct timeval {
|
||||
time_t tv_sec; /* seconds */
|
||||
long tv_usec; /* and microseconds */
|
||||
};
|
||||
int gettimeofday(struct timeval* tp, void* tzp);
|
||||
|
||||
#endif
|
51
ports/win32/check/time.c
Normal file
51
ports/win32/check/time.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include <time.h>
|
||||
|
||||
#include <windows.h> //I've ommited this line.
|
||||
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
|
||||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
|
||||
#else
|
||||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
|
||||
#endif
|
||||
|
||||
struct timezone
|
||||
{
|
||||
int tz_minuteswest; /* minutes W of Greenwich */
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
};
|
||||
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
{
|
||||
FILETIME ft;
|
||||
unsigned __int64 tmpres = 0;
|
||||
static int tzflag;
|
||||
|
||||
if (NULL != tv)
|
||||
{
|
||||
GetSystemTimeAsFileTime(&ft);
|
||||
|
||||
tmpres |= ft.dwHighDateTime;
|
||||
tmpres <<= 32;
|
||||
tmpres |= ft.dwLowDateTime;
|
||||
|
||||
/*converting file time to unix epoch*/
|
||||
tmpres -= DELTA_EPOCH_IN_MICROSECS;
|
||||
tmpres /= 10; /*convert into microseconds*/
|
||||
tv->tv_sec = (long)(tmpres / 1000000UL);
|
||||
tv->tv_usec = (long)(tmpres % 1000000UL);
|
||||
}
|
||||
|
||||
if (NULL != tz)
|
||||
{
|
||||
if (!tzflag)
|
||||
{
|
||||
_tzset();
|
||||
tzflag++;
|
||||
}
|
||||
tz->tz_minuteswest = _timezone / 60;
|
||||
tz->tz_dsttime = _daylight;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
7
ports/win32/check/unistd.h
Normal file
7
ports/win32/check/unistd.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef __UNISTD_H__
|
||||
#define __UNISTD_H__
|
||||
|
||||
/* include io.h for read() and write() */
|
||||
#include <io.h>
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user