diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-01-13 14:40:17 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-01-13 14:40:17 +0100 |
commit | 8339d54ddcbc93771fb6eb550cbf2d9ade988fb8 (patch) | |
tree | fbd8392c5d988350de75f2c0dc1ed8707ca203e2 /runtime/msg.c | |
parent | 3d5c805ab6d4e9b8db0a948cda0f73340f2f326b (diff) | |
download | rsyslog-8339d54ddcbc93771fb6eb550cbf2d9ade988fb8.tar.gz rsyslog-8339d54ddcbc93771fb6eb550cbf2d9ade988fb8.tar.bz2 rsyslog-8339d54ddcbc93771fb6eb550cbf2d9ade988fb8.zip |
optimize: do date() call in template processing only if actually needed
Diffstat (limited to 'runtime/msg.c')
-rw-r--r-- | runtime/msg.c | 4 |
1 files changed, 4 insertions, 0 deletions
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); |