From c0c9fcc00c3808e6cda33cb84e0dfb27567c2e0f Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Thu, 10 Feb 2022 07:38:12 +0100 Subject: [PATCH] Shorten timestamp We do not need the date part of the timestamp. It simply takes up too much precious line space. In case of logging to file, one can easily conclude the date from the file date information. --- src/misc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/misc.c b/src/misc.c index d65e9fd..2eb0e83 100644 --- a/src/misc.c +++ b/src/misc.c @@ -28,8 +28,8 @@ #include "error.h" #include "print.h" -// "YYYY-MM-DDThh:mm:ss.sss" (ISO-8601 format). -#define TIME_STRING_SIZE 24 +// "hh:mm:ss.sss" +#define TIME_STRING_SIZE 15 char * current_time(void) { @@ -46,7 +46,7 @@ char * current_time(void) exit(EXIT_FAILURE); } - size_t len = strftime(time_string, sizeof(time_string), "%Y-%m-%dT%H:%M:%S", tmp); + size_t len = strftime(time_string, sizeof(time_string), "%H:%M:%S", tmp); if (len) { len = snprintf(time_string + len, TIME_STRING_SIZE - len, ".%03ld", (long)tv.tv_usec / 1000); }