42_Philosopher/time.c
2023-04-19 11:53:50 +00:00

15 lines
260 B
C

#include <bits/types/struct_timeval.h>
#include <sys/time.h>
#include <stddef.h>
#include <pthread.h>
size_t get_time(void)
{
size_t time;
struct timeval tv;
gettimeofday(&tv, NULL);
time = tv.tv_sec * 1000000 + tv.tv_usec;
return (time / 1000);
}