aboutsummaryrefslogtreecommitdiff
path: root/src/calculer.c
diff options
context:
space:
mode:
authorTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-06-25 18:20:36 +0900
committerTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-06-25 18:20:36 +0900
commitbbff771d70698a148267d3e510b33858879ea8d0 (patch)
treeb660c2dedac25448e176f2fab08c210cbb8790bc /src/calculer.c
parenta2717d73257a8a03fc0d4840c2d0b0eda8640092 (diff)
Display time calculations take
Diffstat (limited to 'src/calculer.c')
-rw-r--r--src/calculer.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/calculer.c b/src/calculer.c
index 589724f..8c1b629 100644
--- a/src/calculer.c
+++ b/src/calculer.c
@@ -31,6 +31,8 @@
static int lower = 0;
static int upper = 100;
+static int ms;
+
static FILE *logfile;
static char logbuf[64];
#define LOGBUF_OFFSET 11
@@ -67,10 +69,10 @@ measure_after(void *data, int correct)
struct timespec tp;
clock_gettime(CLOCK_REALTIME, &tp);
int t1 = tp_ms(&tp);
- int dt = t1 - t0;
+ ms = t1 - t0;
size_t bytes_written =
LOGBUF_OFFSET + sprintf(logbuf + LOGBUF_OFFSET,
- "%d\t%d\n", dt, correct);
+ "%d\t%d\n", ms, correct);
return bytes_written != fwrite(logbuf, 1, bytes_written, logfile);
}
@@ -214,7 +216,7 @@ main(int argc, char *argv[])
}
#endif
measure_after(measure_data, input == res);
- disp->display_res(input == res, 0);
+ disp->display_res(input == res, ms);
}
fclose(logfile);