summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
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);