From bbff771d70698a148267d3e510b33858879ea8d0 Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Tue, 25 Jun 2024 18:20:36 +0900 Subject: Display time calculations take --- src/calculer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/calculer.c') 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); -- cgit v1.2.3