summary refs log tree commit diff
diff options
context:
space:
mode:
authorwrmr2025-06-23 14:29:57 -0400
committerwrmr2025-06-23 14:29:57 -0400
commitbefb596a1562696bb0471a7fff59263fcbb1bc32 (patch)
treeea8eb97a53cbc8f6b758862fd9a3ed6069f301c5
parentc78e41014074b626cc4644030a530dc46871a868 (diff)
use Str for timestamp output
-rw-r--r--main.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/main.c b/main.c
index 0c321a0..93a3188 100644
--- a/main.c
+++ b/main.c
@@ -316,9 +316,8 @@ void gfx_draw_post(GfxPost *post, int y, int x, int width) {
 	mvaddch(top, right, ACS_URCORNER);
 
 	color_set(CPAIR_TIME, 0);
-	char *tstamp = ctime(&(time_t){post->src->timestamp.tv_sec});
-	tstamp[strlen(tstamp) - 1] = '\0'; /* remove trailing newline */
-	mvaddstr(y, x + width - strlen(tstamp), tstamp);
+	Str s = str_trim(str_from_cstr(ctime(&(time_t){post->src->timestamp.tv_sec})));
+	mvaddnstr(y, x + width - s.n, s.s, s.n);
 
 	color_set(CPAIR_USER, 0);
 	mvaddnstr(y, x + 2, post->src->user.s, post->src->user.n);