X-Git-Url: https://git.wpitchoune.net/gitweb/?p=psensor-pkg-ubuntu.git;a=blobdiff_plain;f=src%2Flib%2Fslog.c;h=99eb536d1954a9996163bd112ded7089ef9bb1d8;hp=cb2b124af527e5750d5378436d2a166ad30135bf;hb=c271a4d106a1242ff18b6f5aeb3f56280c7eaf2c;hpb=ff4ef48059048e93efa634e36d2ad10973a13de3 diff --git a/src/lib/slog.c b/src/lib/slog.c index cb2b124..99eb536 100644 --- a/src/lib/slog.c +++ b/src/lib/slog.c @@ -33,7 +33,7 @@ #include "bool.h" #include "config.h" -#include "log.h" +#include #include "ptime.h" #include "slog.h" @@ -47,6 +47,24 @@ static time_t st; static const char *DEFAULT_FILENAME = "sensors.log"; +static char *time_to_str(time_t *t) +{ + struct tm lt; + char *str; + + if (!localtime_r(t, <)) + return NULL; + + str = malloc(64); + + if (strftime(str, 64, "%s", <)) { + return str; + } else { + free(str); + return NULL; + } +} + static char *get_default_path() { char *home, *path, *dir;