1、linux //#include <unistd.h>
#ifdef WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif
2、linux //#include <sys/time.h>
#ifdef WIN32
#include <time.h>
#include <windows.h>
#else
#include <sys/time.h>
#endif
3、linux struct timeval xxx_time_;
struct timeval yyy_time_;
windows上 需要#include <windows.h>
4、linux gettimeofday(&xxx_time_, NULL);
windows改写
#ifdef WIN32
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_