diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/calculer.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/calculer.c b/src/calculer.c index 6b279ec..8d13052 100644 --- a/src/calculer.c +++ b/src/calculer.c @@ -41,12 +41,15 @@ calculer_rand(void) return lower + rand()%(upper-lower); } +/* Compute the number of milliseconds TP contains. */ static intptr_t tp_ms(struct timespec const *tp) { return tp->tv_sec*1000 + tp->tv_nsec/1000000; } +/* Called just before prompting the user. The returned pointer will be given + back as a parameter of measure_after. */ static void * measure_before(void) { @@ -55,6 +58,7 @@ measure_before(void) return (void *)tp_ms(&tp); } +/* Called just after the user prompt has been read and checked. */ int measure_after(void *data, int correct) { @@ -111,6 +115,7 @@ main(int argc, char *argv[]) srand(time(NULL)); + /* Store the prefix "YYYY-MM-DD" in LOGBUF. */ time_t now = time(NULL); struct tm *tm = localtime(&now); size_t bytes_written = strftime(logbuf, sizeof(logbuf), "%F\t", tm); |