mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
When faking gettimeofday with ftime, do it right.
svn:r2068
This commit is contained in:
parent
2a339b7627
commit
06c11a61ce
@ -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
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user