summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-07-08 22:49:39 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-07-08 22:49:39 -0700
commit9fe586bcac581b3b2a2013a34907e1817b3f24bb (patch)
tree67de6be7d0e1c541cd650a3dfec8fd80fbcbda27
parent8132787168fa57da870edfb816589588d4620e1b (diff)
til: add timersub macro for __WIN32__
just quick and nasty hacking to make win32 build again
-rw-r--r--src/til.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/til.c b/src/til.c
index c8133ef..d343d2a 100644
--- a/src/til.c
+++ b/src/til.c
@@ -112,6 +112,19 @@ void til_shutdown(void)
}
+#ifdef __WIN32__
+/* taken from glibc <sys/time.h> just to make windows happy*/
+# define timersub(a, b, result) \
+ do { \
+ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
+ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
+ if ((result)->tv_usec < 0) { \
+ --(result)->tv_sec; \
+ (result)->tv_usec += 1000000; \
+ } \
+ } while (0)
+#endif
+
/* returns number of "ticks" since til_init(), which are currently milliseconds */
unsigned til_ticks_now(void)
{
© All Rights Reserved