From 82f57cfea6a6f6dd8dbdd1e35d5791920e247de0 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 20 Jul 2004 21:23:50 +0000 Subject: [PATCH] When faking gettimeofday with ftime, do it right. svn:r2068 --- trunk/src/common/util.c | 5 ++++- trunk/src/common/util.h | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/trunk/src/common/util.c b/trunk/src/common/util.c index d7f8e45cbe..21cb010b32 100644 --- a/trunk/src/common/util.c +++ b/trunk/src/common/util.c @@ -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 diff --git a/trunk/src/common/util.h b/trunk/src/common/util.h index 51a5440051..0cc08e9a10 100644 --- a/trunk/src/common/util.h +++ b/trunk/src/common/util.h @@ -30,9 +30,10 @@ #ifdef HAVE_FTIME #define USING_FAKE_TIMEVAL #include -#define timeval timeb -#define tv_sec time -#define tv_usec millitm +struct timeval { + time_t tv_sec; + unsigned int tv_usec; +}; #endif #endif