Amit Pundir | d477f82 | 2020-02-07 22:26:08 +0530 | [diff] [blame] | 1 | #include <string.h> |
2 | #include <stdio.h> | ||||
3 | #include <unistd.h> | ||||
4 | #include <sys/time.h> | ||||
5 | |||||
6 | #include "util.h" | ||||
7 | |||||
8 | uint64_t time_ms(void) | ||||
9 | { | ||||
10 | struct timeval tv; | ||||
11 | gettimeofday(&tv, NULL); | ||||
12 | return (uint64_t)tv.tv_sec*1000 + tv.tv_usec/1000; | ||||
13 | } | ||||
14 | |||||
15 | void util_sleep(int ms) | ||||
16 | { | ||||
17 | usleep(ms * 1000); | ||||
18 | } |