diff options
Diffstat (limited to 'common/util.c')
-rw-r--r-- | common/util.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/common/util.c b/common/util.c index c7ef2ac4..cb142a5e 100644 --- a/common/util.c +++ b/common/util.c | |||
@@ -1,8 +1,8 @@ | |||
1 | #define _POSIX_C_SOURCE 200809L | 1 | #define _POSIX_C_SOURCE 200809L |
2 | #include <ctype.h> | 2 | #include <ctype.h> |
3 | #include <float.h> | ||
4 | #include <fcntl.h> | 3 | #include <fcntl.h> |
5 | #include <math.h> | 4 | #include <math.h> |
5 | #include <time.h> | ||
6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
7 | #include <string.h> | 7 | #include <string.h> |
8 | #include <strings.h> | 8 | #include <strings.h> |
@@ -10,6 +10,12 @@ | |||
10 | #include "log.h" | 10 | #include "log.h" |
11 | #include "util.h" | 11 | #include "util.h" |
12 | 12 | ||
13 | uint32_t get_current_time_msec(void) { | ||
14 | struct timespec now; | ||
15 | clock_gettime(CLOCK_MONOTONIC, &now); | ||
16 | return now.tv_sec * 1000 + now.tv_nsec / 1000000; | ||
17 | } | ||
18 | |||
13 | int wrap(int i, int max) { | 19 | int wrap(int i, int max) { |
14 | return ((i % max) + max) % max; | 20 | return ((i % max) + max) % max; |
15 | } | 21 | } |