aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-07-20 21:23:50 +0000
committerNick Mathewson <nickm@torproject.org>2004-07-20 21:23:50 +0000
commit06c11a61ce3eb3143d99c071d0e05b7fd1bdad45 (patch)
tree32cd79aec250789d3b282251e6bb2b93dac5e619
parent2a339b7627bad567c54a7e274462f8abf66efdf8 (diff)
downloadtor-06c11a61ce3eb3143d99c071d0e05b7fd1bdad45.tar
tor-06c11a61ce3eb3143d99c071d0e05b7fd1bdad45.tar.gz
When faking gettimeofday with ftime, do it right.
svn:r2068
-rw-r--r--src/common/util.c5
-rw-r--r--src/common/util.h7
2 files changed, 8 insertions, 4 deletions
diff --git a/src/common/util.c b/src/common/util.c
index d7f8e45cb..21cb010b3 100644
--- a/src/common/util.c
+++ b/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/src/common/util.h b/src/common/util.h
index 51a544005..0cc08e9a1 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -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