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 3c5244c431
commit 82f57cfea6
2 changed files with 8 additions and 4 deletions
+4 -1
View File
@@ -808,7 +808,10 @@ void tor_gettimeofday(struct timeval *timeval) {
exit(1);
}
#elif defined(HAVE_FTIME)
ftime(timeval);
struct timeb tb;
ftime(&tb);
timeval->tv_sec = tb.time;
timeval->tv_usec = tb.millitm * 1000;
#else
#error "No way to get time."
#endif
+4 -3
View File
@@ -30,9 +30,10 @@
#ifdef HAVE_FTIME
#define USING_FAKE_TIMEVAL
#include <sys/timeb.h>
#define timeval timeb
#define tv_sec time
#define tv_usec millitm
struct timeval {
time_t tv_sec;
unsigned int tv_usec;
};
#endif
#endif