When faking gettimeofday with ftime, do it right.

svn:r2068
This commit is contained in:
Nick Mathewson 2004-07-20 21:23:50 +00:00
parent 2a339b7627
commit 06c11a61ce
2 changed files with 8 additions and 4 deletions

View File

@ -808,7 +808,10 @@ void tor_gettimeofday(struct timeval *timeval) {
exit(1); exit(1);
} }
#elif defined(HAVE_FTIME) #elif defined(HAVE_FTIME)
ftime(timeval); struct timeb tb;
ftime(&tb);
timeval->tv_sec = tb.time;
timeval->tv_usec = tb.millitm * 1000;
#else #else
#error "No way to get time." #error "No way to get time."
#endif #endif

View File

@ -30,9 +30,10 @@
#ifdef HAVE_FTIME #ifdef HAVE_FTIME
#define USING_FAKE_TIMEVAL #define USING_FAKE_TIMEVAL
#include <sys/timeb.h> #include <sys/timeb.h>
#define timeval timeb struct timeval {
#define tv_sec time time_t tv_sec;
#define tv_usec millitm unsigned int tv_usec;
};
#endif #endif
#endif #endif