From 4300e4022314514c982ef401b36f3061aa926ca1 Mon Sep 17 00:00:00 2001 From: awy Date: Mon, 25 Aug 2025 19:38:44 +0300 Subject: updates --- src/stclock.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/stclock.c') diff --git a/src/stclock.c b/src/stclock.c index 7591825..22dae6a 100644 --- a/src/stclock.c +++ b/src/stclock.c @@ -17,11 +17,18 @@ #include #include +#include "../lib/util.h" + int main(void) { - time_t t = time(NULL); - struct tm *tm = localtime(&t); - printf("%02d:%02d", tm->tm_hour, tm->tm_min); + time_t t; + char buf[64]; + + t = time(NULL); + if (!strftime(buf, sizeof(buf), "%F %T", localtime(&t))) + die("strftime: Result string exceeds buffer size"); + + printf("%s", buf); return 0; } -- cgit v1.2.3