summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
authorzugz (tox) <mbays+tox@sdf.org>2018-10-31 19:33:32 +0100
committerzugz (tox) <mbays+tox@sdf.org>2018-10-31 19:34:52 +0100
commitb56166f5a6dd2eaef4861c50cbb11b3568aa040e (patch)
tree73c04dc6c996285617ddd1fab73d25b62b35a4a8 /toxcore
parent15cc8050d22dcc2243ff9041c7670a40997f93e8 (diff)
Add some hopefully helpful documentation to the functions in mono_time.h
(I found I couldn't remember whether get_mono_time returned unix time or not, and had to source-dive to find out. This should make that unnecessary next time!)
Diffstat (limited to 'toxcore')
-rw-r--r--toxcore/mono_time.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/toxcore/mono_time.h b/toxcore/mono_time.h
index 503548f2..aa244bae 100644
--- a/toxcore/mono_time.h
+++ b/toxcore/mono_time.h
@@ -45,11 +45,26 @@ typedef struct Mono_Time Mono_Time;
45Mono_Time *mono_time_new(void); 45Mono_Time *mono_time_new(void);
46void mono_time_free(Mono_Time *mono_time); 46void mono_time_free(Mono_Time *mono_time);
47 47
48/**
49 * Update mono_time; subsequent calls to mono_time_get or mono_time_is_timeout
50 * will use the time at the call to mono_time_update.
51 */
48void mono_time_update(Mono_Time *mono_time); 52void mono_time_update(Mono_Time *mono_time);
53
54/**
55 * Return unix time since epoch in seconds.
56 */
49uint64_t mono_time_get(const Mono_Time *mono_time); 57uint64_t mono_time_get(const Mono_Time *mono_time);
58
59/**
60 * Return true iff timestamp is at least timeout seconds in the past.
61 */
50bool mono_time_is_timeout(const Mono_Time *mono_time, uint64_t timestamp, uint64_t timeout); 62bool mono_time_is_timeout(const Mono_Time *mono_time, uint64_t timestamp, uint64_t timeout);
51 63
52/* return current monotonic time in milliseconds (ms). */ 64/**
65 * Return current monotonic time in milliseconds (ms). The starting point is
66 * unspecified.
67 */
53uint64_t current_time_monotonic(Mono_Time *mono_time); 68uint64_t current_time_monotonic(Mono_Time *mono_time);
54 69
55typedef uint64_t mono_time_current_time_cb(Mono_Time *mono_time, void *user_data); 70typedef uint64_t mono_time_current_time_cb(Mono_Time *mono_time, void *user_data);