Added files to compile check 0.9.8 under win32 (no fork support, of course)

This commit is contained in:
goldsimon 2010-01-24 17:36:51 +00:00
parent 015165df14
commit 0f5c7fa169
4 changed files with 82 additions and 0 deletions

View 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>

View 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
View 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;
}

View File

@ -0,0 +1,7 @@
#ifndef __UNISTD_H__
#define __UNISTD_H__
/* include io.h for read() and write() */
#include <io.h>
#endif