aboutsummaryrefslogtreecommitdiff
path: root/common.h
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2019-04-17 14:38:23 +0200
committerAnton Khirnov <anton@khirnov.net>2019-04-19 17:11:40 +0200
commit5b94910fc4c6a47856290e9c23f9a905cf63c1eb (patch)
treee33245aef4e7885b801e1a2474c18e1ed9737518 /common.h
parent8c35e7648cf7db413e1d2a9478edec797eac5df3 (diff)
Add and use a new timer API.
Diffstat (limited to 'common.h')
-rw-r--r--common.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/common.h b/common.h
index 0a36ca9..03b33f6 100644
--- a/common.h
+++ b/common.h
@@ -24,16 +24,18 @@
#define MIN(x, y) ((x) > (y) ? (y) : (x))
#define ARRAY_ELEMS(arr) (sizeof(arr) / sizeof(*arr))
+#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
-#include <sys/time.h>
-static inline int64_t gettime(void)
-{
- struct timeval tv;
- gettimeofday(&tv, NULL);
- return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
-}
#define FD_STENCIL_MAX 4
+#define mg2di_assert(x) \
+do { \
+ if (!(x)) { \
+ fprintf(stderr, "Assertion " #x " failed\n"); \
+ abort(); \
+ } \
+} while (0)
+
#endif /* MG2D_COMMON_H */