]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
When faking gettimeofday with ftime, do it right.
authorNick Mathewson <nickm@torproject.org>
Tue, 20 Jul 2004 21:23:50 +0000 (21:23 +0000)
committerNick Mathewson <nickm@torproject.org>
Tue, 20 Jul 2004 21:23:50 +0000 (21:23 +0000)
svn:r2068

src/common/util.c
src/common/util.h

index d7f8e45cbe8113edd915d8ddd1c875be1ccb95d4..21cb010b32466226e226458df301f6ecdf929af5 100644 (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
index 51a5440051569255610d13190018350f36b1faa0..0cc08e9a10513fb6dc5b1c49eb2e79cf6b273b56 100644 (file)
 #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