From 01e2cc55cbb5fd0d89d7624124674307266ef4ee Mon Sep 17 00:00:00 2001 From: "zugz (tox)" Date: Fri, 17 Aug 2018 19:22:58 +0200 Subject: Add support for setting a custom monotonic time function in mono_time --- toxcore/mono_time.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'toxcore/mono_time.h') diff --git a/toxcore/mono_time.h b/toxcore/mono_time.h index ed69e3b0..b735f2c3 100644 --- a/toxcore/mono_time.h +++ b/toxcore/mono_time.h @@ -52,6 +52,16 @@ bool mono_time_is_timeout(const Mono_Time *mono_time, uint64_t timestamp, uint64 /* return current monotonic time in milliseconds (ms). */ uint64_t current_time_monotonic(const Mono_Time *mono_time); +typedef uint64_t mono_time_current_time_cb(void *user_data); + +/* Override implementation of current_time_monotonic() (for tests). + * + * The caller is obligated to ensure that current_time_monotonic() continues + * to increase monotonically. + */ +void mono_time_set_current_time_callback(Mono_Time *mono_time, + mono_time_current_time_cb *current_time_callback, void *user_data); + #ifdef __cplusplus } #endif -- cgit v1.2.3