init
This commit is contained in:
17
time.c
Normal file
17
time.c
Normal file
@ -0,0 +1,17 @@
|
||||
#include <bits/types/struct_timeval.h>
|
||||
#include <sys/time.h>
|
||||
#include <stddef.h>
|
||||
#include <pthread.h>
|
||||
|
||||
size_t get_time(void)
|
||||
{
|
||||
size_t timedefault = 0;
|
||||
size_t time;
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
time = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
if (timedefault == 0)
|
||||
timedefault = time;
|
||||
return ((time - timedefault) / 1000);
|
||||
}
|
Reference in New Issue
Block a user