summaryrefslogtreecommitdiff
path: root/toxcore/util.h
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-07-08 08:43:42 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-07-09 21:04:50 +0000
commitabc17b0f8997ab07ae66130edd5dc8c43e72c886 (patch)
tree88056839c808a9f7f8c58f55ebe273aa7b5facdb /toxcore/util.h
parent4e21c065517d6e125cb1d1b9a13e886b3046b0d8 (diff)
Factor out time keeping code into its own module: mono_time.c.
It turns out, `unix_time` is also monotonic, and is used as such, so I've renamed the new functions to `mono_time_*`. 2018-07-08: ``` 00:01 <@irungentoo> the idea used to be that the unix_time() function could go backward in time but I think I might have started using it like if it could not after I changed it so that it would never go back in time ```
Diffstat (limited to 'toxcore/util.h')
-rw-r--r--toxcore/util.h15
1 files changed, 0 insertions, 15 deletions
diff --git a/toxcore/util.h b/toxcore/util.h
index de493ebe..4c5023cf 100644
--- a/toxcore/util.h
+++ b/toxcore/util.h
@@ -39,21 +39,6 @@ extern "C" {
39#define MIN(a,b) (((a)<(b))?(a):(b)) 39#define MIN(a,b) (((a)<(b))?(a):(b))
40#define PAIR(TYPE1__, TYPE2__) struct { TYPE1__ first; TYPE2__ second; } 40#define PAIR(TYPE1__, TYPE2__) struct { TYPE1__ first; TYPE2__ second; }
41 41
42typedef struct Unix_Time Unix_Time;
43
44Unix_Time *unix_time_new(void);
45void unix_time_free(Unix_Time *unixtime);
46
47// TODO(#405): Use per-tox unixtime, remove unix_time_update, and rename
48// unix_time_update_r to unix_time_update.
49void unix_time_update_r(Unix_Time *unixtime);
50uint64_t unix_time_get(const Unix_Time *unixtime);
51int unix_time_is_timeout(const Unix_Time *unixtime, uint64_t timestamp, uint64_t timeout);
52
53void unix_time_update(void);
54uint64_t unix_time(void);
55int is_timeout(uint64_t timestamp, uint64_t timeout);
56
57/* id functions */ 42/* id functions */
58bool id_equal(const uint8_t *dest, const uint8_t *src); 43bool id_equal(const uint8_t *dest, const uint8_t *src);
59uint32_t id_copy(uint8_t *dest, const uint8_t *src); /* return value is CLIENT_ID_SIZE */ 44uint32_t id_copy(uint8_t *dest, const uint8_t *src); /* return value is CLIENT_ID_SIZE */