X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Flogfile.c;h=6d555842f787dda0c687c0a08d2cf4657cd6aba3;hb=19a7c076959e16df16be966d4c3aa563431ef038;hp=11797182639e35902be3e431022f667d9eb99839;hpb=3aeca36659b04725028f123bcea387a37581624a;p=collectd.git diff --git a/src/logfile.c b/src/logfile.c index 11797182..6d555842 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -27,11 +27,10 @@ **/ #include "collectd.h" + #include "common.h" #include "plugin.h" -#include - #define DEFAULT_LOGFILE LOCALSTATEDIR"/log/collectd.log" #if COLLECT_DEBUG @@ -91,7 +90,6 @@ static void logfile_print (const char *msg, int severity, { FILE *fh; _Bool do_close = 0; - struct tm timestamp_tm; char timestamp_str[64]; char level_str[16] = ""; @@ -121,8 +119,8 @@ static void logfile_print (const char *msg, int severity, if (print_timestamp) { - time_t tt = CDTIME_T_TO_TIME_T (timestamp_time); - localtime_r (&tt, ×tamp_tm); + struct tm timestamp_tm; + localtime_r (&CDTIME_T_TO_TIME_T (timestamp_time), ×tamp_tm); strftime (timestamp_str, sizeof (timestamp_str), "%Y-%m-%d %H:%M:%S", ×tamp_tm);