aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2020-06-05 17:12:31 -0400
committerFurkan Sahin <furkan-dev@proton.me>2020-06-05 17:12:31 -0400
commit6c8250605f6b259ac6ee2a1e6b24b6cfc536adb0 (patch)
treeed8ca52d119bdbc250c3e2e7d5e7f8f63d450449 /include
parent9371fdf70425a0b7433dd3f82bd504b5fe380bfb (diff)
common/util: fix `get_current_time_msec` returning microseconds
This commit makes `get_current_time_msec` correctly return milliseconds as opposed to microseconds. It also considers the value of `tv_sec`, so we don't lose occasionally go back in time by one second. Finally, the function is moved into `util.c` so that it can be reused elsewhere without having to consider these pitfalls.
Diffstat (limited to 'include')
-rw-r--r--include/util.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/util.h b/include/util.h
index 867eb0a4..7f47d713 100644
--- a/include/util.h
+++ b/include/util.h
@@ -6,7 +6,13 @@
#include <wayland-server-protocol.h>
/**
- * Wrap i into the range [0, max[
+ * Get the current time, in milliseconds.
+ */
+
+uint32_t get_current_time_msec(void);
+
+/**
+ * Wrap i into the range [0, max]
*/
int wrap(int i, int max);