diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-05-29 17:01:03 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-05-29 17:01:03 +0200 |
commit | 59802547c336d61aa7e950414a3f44180e211974 (patch) | |
tree | cf7107b9085ce3c93e98ec874d25e04ad2362a4c /client/time_linux.c | |
parent | 3b2c2cf6b2af9e76b343a5a8fc8e9245f240690d (diff) |
client ping working
Diffstat (limited to 'client/time_linux.c')
-rw-r--r-- | client/time_linux.c | 21 |
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 |