add: time is now relatif
This commit is contained in:
parent
6148d6effe
commit
7e77316d53
5
time.c
5
time.c
@ -6,9 +6,12 @@
|
|||||||
size_t get_time(void)
|
size_t get_time(void)
|
||||||
{
|
{
|
||||||
size_t time;
|
size_t time;
|
||||||
|
static size_t start_time = 0;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
time = tv.tv_sec * 1000000 + tv.tv_usec;
|
time = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||||
return (time / 1000);
|
if (start_time == 0)
|
||||||
|
start_time = time;
|
||||||
|
return ((time - start_time) / 1000);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user