summaryrefslogtreecommitdiff
path: root/toxcore/mono_time.h
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/mono_time.h')
-rw-r--r--toxcore/mono_time.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/toxcore/mono_time.h b/toxcore/mono_time.h
new file mode 100644
index 00000000..63e0f49d
--- /dev/null
+++ b/toxcore/mono_time.h
@@ -0,0 +1,35 @@
1#ifndef C_TOXCORE_TOXCORE_MONO_TIME_H
2#define C_TOXCORE_TOXCORE_MONO_TIME_H
3
4#include <stdbool.h>
5#include <stdint.h>
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11typedef struct Mono_Time Mono_Time;
12
13Mono_Time *mono_time_new(void);
14void mono_time_free(Mono_Time *monotime);
15
16void mono_time_update(Mono_Time *monotime);
17uint64_t mono_time_get(const Mono_Time *monotime);
18bool mono_time_is_timeout(const Mono_Time *monotime, uint64_t timestamp, uint64_t timeout);
19
20// TODO(#405): Use per-tox monotime, delete these functions.
21void unix_time_update(void);
22uint64_t unix_time(void);
23int is_timeout(uint64_t timestamp, uint64_t timeout);
24
25/* return current UNIX time in microseconds (us). */
26uint64_t current_time_actual(void);
27
28/* return current monotonic time in milliseconds (ms). */
29uint64_t current_time_monotonic(void);
30
31#ifdef __cplusplus
32}
33#endif
34
35#endif // C_TOXCORE_TOXCORE_MONO_TIME_H