summaryrefslogtreecommitdiff
path: root/src/common/compat_time.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-07-21 11:04:22 +0200
committerNick Mathewson <nickm@torproject.org>2016-07-21 07:02:33 -0400
commit2d26b1a54901bff8f508bfebeea3fb471cf36a9d (patch)
treec2e0d91c82097b66dfff1517e00c16aeb456edfe /src/common/compat_time.h
parent72a1f0180dbbc0a96e128d940b53ebf0f1c570d7 (diff)
downloadtor-2d26b1a54901bff8f508bfebeea3fb471cf36a9d.tar.gz
tor-2d26b1a54901bff8f508bfebeea3fb471cf36a9d.zip
Actually make monotonic time functions mockable.
This is different from making the functions mockable, since monotime_t is opaque and so providing mocks for the functions is really hard.
Diffstat (limited to 'src/common/compat_time.h')
-rw-r--r--src/common/compat_time.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/compat_time.h b/src/common/compat_time.h
index 8d61bc2580..de6994fafb 100644
--- a/src/common/compat_time.h
+++ b/src/common/compat_time.h
@@ -130,6 +130,15 @@ void tor_gettimeofday(struct timeval *timeval);
#ifdef TOR_UNIT_TESTS
void tor_sleep_msec(int msec);
+
+void monotime_enable_test_mocking(void);
+void monotime_disable_test_mocking(void);
+void monotime_set_mock_time_nsec(int64_t);
+#if defined(MONOTIME_COARSE_FN_IS_DIFFERENT)
+void monotime_coarse_set_mock_time_nsec(int64_t);
+#else
+#define monotime_coarse_set_mock_time_nsec monotime_set_mock_time_nsec
+#endif
#endif
#ifdef COMPAT_TIME_PRIVATE