suckless/components/datetime.c
alejandrogs73 2ed1e8d89d Squashed 'slstatus/' content from commit 675c839
git-subtree-dir: slstatus
git-subtree-split: 675c83912ea1aca9834448aaa87a040bc9990c52
2026-09-25 10:52:06 +02:00

20 lines
358 B
C

/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <time.h>
#include "../slstatus.h"
#include "../util.h"
const char *
datetime(const char *fmt)
{
time_t t;
t = time(NULL);
if (!strftime(buf, sizeof(buf), fmt, localtime(&t))) {
warn("strftime: Result string exceeds buffer size");
return NULL;
}
return buf;
}