X-Git-Url: http://wpitchoune.net/gitweb/?p=psensor-pkg-debian.git;a=blobdiff_plain;f=src%2Flib%2Fslog.c;fp=src%2Flib%2Fslog.c;h=99eb536d1954a9996163bd112ded7089ef9bb1d8;hp=cb2b124af527e5750d5378436d2a166ad30135bf;hb=e248180cc4ebc258fdd5778a26c08287089165b1;hpb=162a992f0f857ef0969d64206b9762f0d054528f 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;