#include #ifdef WIN32 #include #endif #include "gettimeofday.h" int gettimeofday(struct timeval *tp, void *tzp) { #ifdef WIN32 struct _timeb timebuffer; _ftime(&timebuffer); tp->tv_sec = timebuffer.time; tp->tv_usec = timebuffer.millitm * 1000; return 0; #else tp->tv_sec = time(NULL); tp->tv_usec = 0; return 0; #endif }