summaryrefslogtreecommitdiff
path: root/client/time_linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/time_linux.c')
-rw-r--r--client/time_linux.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/client/time_linux.c b/client/time_linux.c
new file mode 100644
index 0000000..5b72838
--- /dev/null
+++ b/client/time_linux.c
@@ -0,0 +1,21 @@
+#ifdef W2_HOST_LINUX
+
+#include <time.h>
+
+#include "time.h"
+
+unsigned long w2_get_time() {
+ struct timespec now;
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ return ((now.tv_sec * 1000) + (now.tv_nsec / 1000000));
+}
+
+void w2_timer_start(w2_e_client_timers label) {
+ g_w2_client_timers[label] = w2_get_time();
+}
+
+unsigned long w2_timer_end(w2_e_client_timers label) {
+ return w2_get_time() - g_w2_client_timers[label];
+}
+
+#endif