]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make tor_gettimeofday() mockable
authorNeel Chauhan <neel@neelc.org>
Tue, 17 Apr 2018 00:18:40 +0000 (20:18 -0400)
committerNeel Chauhan <neel@neelc.org>
Tue, 17 Apr 2018 00:37:50 +0000 (20:37 -0400)
src/common/compat_time.c
src/common/compat_time.h

index b940447b67b5655250c9f020c709ab6c77529a59..966216768f0f7ae5fef6c3918889a0031081f8c4 100644 (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
index 75b57f6f24ab24cf2cf916e7b006b8664880b7c2..09dd6add3da16c04e1cd6865025a9af44c1448b0 100644 (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);