rely on winsock2 for timeval declaration

This commit is contained in:
Stephen Birarda 2014-04-10 11:06:22 -07:00
parent 7d4399da35
commit 53aafd6897
2 changed files with 4 additions and 27 deletions

View file

@ -1,14 +1,13 @@
#ifdef _WIN32
#include <windows.h>
#define _timeval_
#include "Systime.h"
int gettimeofday( timeval* p_tv, timezone* p_tz )
{
int gettimeofday(timeval* p_tv, timezone* p_tz) {
int tt = timeGetTime();
p_tv->tv_sec = tt / 1000;
p_tv->tv_usec = tt % 1000 * 1000;
return 0;
}
#endif

View file

@ -1,38 +1,16 @@
#ifndef __Systime__
#define __Systime__
#ifdef _WIN32
#ifdef _WINSOCK2API_
#define _timeval_
#endif
#ifndef _timeval_
#define _timeval_
/*
* Structure returned by gettimeofday(2) system call,
* and used in other calls.
*/
// this is a bit of a hack for now, but sometimes on windows
// we need timeval defined here, sometimes we get it
// from winsock.h
#ifdef WANT_TIMEVAL
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* and microseconds */
};
#endif
#endif _timeval_
#include <winsock2.h>
struct timezone {
int tz_minuteswest; /* minutes west of Greenwich */
int tz_dsttime; /* type of dst correction */
};
int gettimeofday( struct timeval* p_tv, struct timezone* p_tz );
int gettimeofday(struct timeval* p_tv, struct timezone* p_tz);
#endif _Win32