From 6cc3530a72162a5a27bed517732fa17e5d435dd9 Mon Sep 17 00:00:00 2001 From: joe Date: Fri, 17 Oct 2025 14:25:39 +0200 Subject: time format --- kirc.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'kirc.c') diff --git a/kirc.c b/kirc.c index 20bd3ce..53b27fc 100644 --- a/kirc.c +++ b/kirc.c @@ -1062,25 +1062,23 @@ static void param_print_private(param p) struct tm *timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); - char timestamp[13]; - if (!small_screen) { - if (strnlen(p->nickname, p->nicklen) > (size_t)p->nicklen - 8) { - *(p->nickname + p->nicklen - 8) = '\0'; - } - strcpy(timestamp, "\x1b[90m"); - char buf[8]; - if (timeinfo->tm_hour < 10) { - strcat(timestamp, "0"); - } - snprintf(buf, sizeof(buf), "%d:", timeinfo->tm_hour); - strcat(timestamp, buf); - if (timeinfo->tm_min < 10) { - strcat(timestamp, "0"); - } - snprintf(buf, sizeof(buf), "%d\x1b[0m ", timeinfo->tm_min); - strcat(timestamp, buf); - printf("%s", timestamp); - } + char timestamp[16]; + if (strnlen(p->nickname, p->nicklen) > (size_t)p->nicklen - 8) { + *(p->nickname + p->nicklen - 8) = '\0'; + } + strcpy(timestamp, "\x1b[90m"); + char buf[16]; + if (timeinfo->tm_hour < 10) { + strcat(timestamp, "0"); + } + snprintf(buf, sizeof(buf), "%d:", timeinfo->tm_hour); + strcat(timestamp, buf); + if (timeinfo->tm_min < 10) { + strcat(timestamp, "0"); + } + snprintf(buf, sizeof(buf), "%d\x1b[0m ", timeinfo->tm_min); + strcat(timestamp, buf); + printf("%s", timestamp); int s = 0; if (strnlen(p->nickname, MSG_MAX) <= (size_t)p->nicklen + strnlen(timestamp, sizeof(timestamp))) { s = p->nicklen - strnlen(p->nickname, MSG_MAX) - strnlen(timestamp, sizeof(timestamp)); @@ -1146,11 +1144,9 @@ static void raw_parser(char *string) }; if (WRAP_LEN > p.maxcols / 3) { - small_screen = 1; p.nicklen = p.maxcols / 3; } else { - small_screen = 0; p.nicklen = WRAP_LEN; } if (*chan != '\0' && !memcmp(p.command, "001", sizeof("001") - 1)) { -- cgit v1.2.3