From d9b456d738e5013d48f41f5e6315ef7c22d6acf0 Mon Sep 17 00:00:00 2001 From: Sam Light Date: Wed, 10 Sep 2025 19:37:28 +0100 Subject: Initial commit --- src/modules/time.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/modules/time.c (limited to 'src/modules/time.c') diff --git a/src/modules/time.c b/src/modules/time.c new file mode 100644 index 0000000..84f894e --- /dev/null +++ b/src/modules/time.c @@ -0,0 +1,29 @@ +#include "time.h" + +#include +#include +#include + +struct time * +time_new() +{ + struct time * t = malloc(sizeof(struct time)); + return t; +} + +void +time_free(struct time * t) +{ + free(t); +} + +void +time_update(struct time * t) +{ + time_t timer; + struct tm * tm; + + time(&timer); + tm = gmtime(&timer); + strftime(t->value, TIME_VALUE_SIZE, "%F [%a] %T", tm); +} -- cgit v1.2.3