commit ce84de39efc09142d36d5b94963b1aeb2c0a1ae9
parent e72742d693827a747ad405eb81422d6ee9fd691b
Author: Neel Chauhan <neel@neelc.org>
Date: Mon, 16 Apr 2018 20:18:40 -0400
Make tor_gettimeofday() mockable
Diffstat:
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/common/compat_time.c b/src/common/compat_time.c
@@ -71,8 +71,8 @@ tor_sleep_msec(int msec)
/** Set *timeval to the current time of day. On error, log and terminate.
* (Same as gettimeofday(timeval,NULL), but never returns -1.)
*/
-void
-tor_gettimeofday(struct timeval *timeval)
+MOCK_IMPL(void,
+tor_gettimeofday, (struct timeval *timeval))
{
#ifdef _WIN32
/* Epoch bias copied from perl: number of units between windows epoch and
diff --git a/src/common/compat_time.h b/src/common/compat_time.h
@@ -173,7 +173,7 @@ void monotime_coarse_add_msec(monotime_coarse_t *out,
#define monotime_coarse_add_msec monotime_add_msec
#endif /* defined(MONOTIME_COARSE_TYPE_IS_DIFFERENT) */
-void tor_gettimeofday(struct timeval *timeval);
+MOCK_DECL(void, tor_gettimeofday, (struct timeval *timeval));
#ifdef TOR_UNIT_TESTS
void tor_sleep_msec(int msec);