2023-04-13 09:00:39 -04:00
|
|
|
#include <bits/types/struct_timeval.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
|
|
|
|
size_t get_time(void)
|
|
|
|
{
|
|
|
|
size_t time;
|
2023-04-19 10:08:23 -04:00
|
|
|
static size_t start_time = 0;
|
2023-04-13 09:00:39 -04:00
|
|
|
struct timeval tv;
|
|
|
|
|
|
|
|
gettimeofday(&tv, NULL);
|
|
|
|
time = tv.tv_sec * 1000000 + tv.tv_usec;
|
2023-04-19 10:08:23 -04:00
|
|
|
if (start_time == 0)
|
|
|
|
start_time = time;
|
|
|
|
return ((time - start_time) / 1000);
|
2023-04-13 09:00:39 -04:00
|
|
|
}
|