From 3e400c3df5572524b7ba08b030f45eb3ba6b7734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 17 Sep 2021 22:08:50 +0200 Subject: Add database helper functions --- misc.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 misc.c (limited to 'misc.c') diff --git a/misc.c b/misc.c new file mode 100644 index 0000000..e5bdeef --- /dev/null +++ b/misc.c @@ -0,0 +1,19 @@ +#include +#include +#include +#include "misc.h" + +char * +date(int timestamp) +{ + char *buf; + time_t *t; + + if(!(buf = malloc(20))) + err(1, "malloc"); + + t = localtime(×tamp); + strftime(buf, 20, "%Y-%m-%d %H:%M", t); + + return buf; +} \ No newline at end of file -- cgit v1.2.3