From 7e77316d53a427941b3b719c084ee4cf8befc839 Mon Sep 17 00:00:00 2001 From: Camille Chauvet Date: Wed, 19 Apr 2023 14:08:23 +0000 Subject: [PATCH] add: time is now relatif --- time.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/time.c b/time.c index fb42605..720d7eb 100644 --- a/time.c +++ b/time.c @@ -6,9 +6,12 @@ size_t get_time(void) { size_t time; + static size_t start_time = 0; struct timeval tv; gettimeofday(&tv, NULL); time = tv.tv_sec * 1000000 + tv.tv_usec; - return (time / 1000); + if (start_time == 0) + start_time = time; + return ((time - start_time) / 1000); }