aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-06-01 02:45:40 +0900
committerTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-06-01 02:45:40 +0900
commit365015c2c7947456b249b1c13ea1a1f6b40369e6 (patch)
treeb0d21a5e6d70893ece0bc21ae4c50bebcd6f3f58 /src
parent9ef6eb9b5f6190069ccde20c38232b98b48f55c7 (diff)
Add a couple comments
Diffstat (limited to 'src')
-rw-r--r--src/calculer.c5
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);