summaryrefslogtreecommitdiff
path: root/src/stclock.c
diff options
context:
space:
mode:
authorawy <awy@awy.one>2025-08-25 19:38:44 +0300
committerawy <awy@awy.one>2025-08-25 19:38:44 +0300
commit4300e4022314514c982ef401b36f3061aa926ca1 (patch)
treed50da7fcb7775b0e2da9751091714c681a0610e8 /src/stclock.c
parentda3ed11be83694d32285f1773de5232cd51d8b4b (diff)
updates
Diffstat (limited to 'src/stclock.c')
-rw-r--r--src/stclock.c13
1 files changed, 10 insertions, 3 deletions
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 <time.h>
#include <stdio.h>
+#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;
}