estimate tic
authorLaurent Mazet <mazet@softndesign.org>
Mon, 2 Sep 2024 21:17:04 +0000 (23:17 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Mon, 2 Sep 2024 21:17:04 +0000 (23:17 +0200)
time.c

diff --git a/time.c b/time.c
index a342181814b1e75afcc4f2951c9db8cde7a625aa..8ecebf4cf013c50579dd1122cde93fecade3fdab 100644 (file)
--- a/time.c
+++ b/time.c
@@ -1,8 +1,10 @@
+#include <stdio.h>
 #include <stdlib.h>
 #include <sys/time.h>
 #include <time.h>
 #include <unistd.h>
 
+#include "debug.h"
 #include "time.h"
 
 int newseed (int seed)
@@ -27,6 +29,7 @@ int isovertime (timeval_t *t)
     struct timeval _c;
     struct timeval *c = &_c;
     gettimeofday (c, NULL);
+    VERBOSE (INFO, FILE *log = fopen ("snake.log", "a"); long msec = (c->tv_sec == t->tv_sec) ? ((long)c->tv_usec - (long)t->tv_usec) : ((long)t->tv_usec - (long)c->tv_usec); fprintf (log, "diff: %ld\n", msec / 1000); fclose (log));
     return ((t->tv_sec < c->tv_sec) || ((t->tv_sec == c->tv_sec) && ( t->tv_usec < c->tv_usec)));
 }