Make tor_gettimeofday() mockable

This commit is contained in:
Neel Chauhan 2018-04-16 20:18:40 -04:00
parent e72742d693
commit ce84de39ef
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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);