1 #include <string.h> 2 #include <stdio.h> 3 #include <unistd.h> 4 #include <sys/time.h> 5 6 #include "util.h" 7 time_ms(void)8uint64_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 util_sleep(int ms)15void util_sleep(int ms) 16 { 17 usleep(ms * 1000); 18 } 19