diff options
author | zugz (tox) <mbays+tox@sdf.org> | 2018-08-17 19:22:58 +0200 |
---|---|---|
committer | zugz (tox) <mbays+tox@sdf.org> | 2018-08-26 22:05:37 +0200 |
commit | 01e2cc55cbb5fd0d89d7624124674307266ef4ee (patch) | |
tree | 390fa1e029f86f266f4f017659cc78cdedfa1216 /toxcore/mono_time.h | |
parent | acc19a202faad8fb6cbc576b8f4d906ee80e6e16 (diff) |
Add support for setting a custom monotonic time function in mono_time
Diffstat (limited to 'toxcore/mono_time.h')
-rw-r--r-- | toxcore/mono_time.h | 10 |
1 files changed, 10 insertions, 0 deletions
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 | |||
52 | /* return current monotonic time in milliseconds (ms). */ | 52 | /* return current monotonic time in milliseconds (ms). */ |
53 | uint64_t current_time_monotonic(const Mono_Time *mono_time); | 53 | uint64_t current_time_monotonic(const Mono_Time *mono_time); |
54 | 54 | ||
55 | typedef uint64_t mono_time_current_time_cb(void *user_data); | ||
56 | |||
57 | /* Override implementation of current_time_monotonic() (for tests). | ||
58 | * | ||
59 | * The caller is obligated to ensure that current_time_monotonic() continues | ||
60 | * to increase monotonically. | ||
61 | */ | ||
62 | void mono_time_set_current_time_callback(Mono_Time *mono_time, | ||
63 | mono_time_current_time_cb *current_time_callback, void *user_data); | ||
64 | |||
55 | #ifdef __cplusplus | 65 | #ifdef __cplusplus |
56 | } | 66 | } |
57 | #endif | 67 | #endif |