From 8339d54ddcbc93771fb6eb550cbf2d9ade988fb8 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sun, 13 Jan 2013 14:40:17 +0100 Subject: optimize: do date() call in template processing only if actually needed --- runtime/msg.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime/msg.c') diff --git a/runtime/msg.c b/runtime/msg.c index 37df5bd0..d16bbb75 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -2456,6 +2456,10 @@ static uchar *getNOW(eNOWType eNow, struct syslogTime *t) return NULL; } + if(t->year == 0) { /* not yet set! */ + datetime.getCurrTime(t, NULL); + } + switch(eNow) { case NOW_NOW: snprintf((char*) pBuf, tmpBUFSIZE, "%4.4d-%2.2d-%2.2d", t->year, t->month, t->day); -- cgit v1.2.3