diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-07-08 08:43:42 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-07-09 21:04:50 +0000 |
commit | abc17b0f8997ab07ae66130edd5dc8c43e72c886 (patch) | |
tree | 88056839c808a9f7f8c58f55ebe273aa7b5facdb /toxcore/util.h | |
parent | 4e21c065517d6e125cb1d1b9a13e886b3046b0d8 (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.h | 15 |
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 | ||
42 | typedef struct Unix_Time Unix_Time; | ||
43 | |||
44 | Unix_Time *unix_time_new(void); | ||
45 | void 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. | ||
49 | void unix_time_update_r(Unix_Time *unixtime); | ||
50 | uint64_t unix_time_get(const Unix_Time *unixtime); | ||
51 | int unix_time_is_timeout(const Unix_Time *unixtime, uint64_t timestamp, uint64_t timeout); | ||
52 | |||
53 | void unix_time_update(void); | ||
54 | uint64_t unix_time(void); | ||
55 | int is_timeout(uint64_t timestamp, uint64_t timeout); | ||
56 | |||
57 | /* id functions */ | 42 | /* id functions */ |
58 | bool id_equal(const uint8_t *dest, const uint8_t *src); | 43 | bool id_equal(const uint8_t *dest, const uint8_t *src); |
59 | uint32_t id_copy(uint8_t *dest, const uint8_t *src); /* return value is CLIENT_ID_SIZE */ | 44 | uint32_t id_copy(uint8_t *dest, const uint8_t *src); /* return value is CLIENT_ID_SIZE */ |