X-Git-Url: http://wpitchoune.net/gitweb/?p=psensor-pkg-debian.git;a=blobdiff_plain;f=src%2Flib%2Fslog.c;h=99eb536d1954a9996163bd112ded7089ef9bb1d8;hp=d3e646db778dc90c2aaeeb3ac517dad4d9c7f782;hb=ecd968930278d22ce234485d1bddced831c82f0f;hpb=dcd813f21c83592155f712ff1acf450b483d8072 diff --git a/src/lib/slog.c b/src/lib/slog.c index d3e646d..99eb536 100644 --- a/src/lib/slog.c +++ b/src/lib/slog.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013 jeanfi@gmail.com + * Copyright (C) 2010-2014 jeanfi@gmail.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -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;