diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-03-23 07:10:03 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-03-23 07:10:03 +0100 |
commit | d2f242edcb25e69ae7de5a142229330070f2e70b (patch) | |
tree | 8f25fa8de784c877cda4c17452955234cdc2f95e /runtime/datetime.c | |
parent | 396e211e5cfd195b7135947d425b089a0447fa88 (diff) | |
parent | 2f1d5a12037453792eb1000c79daf737b41c5ba4 (diff) | |
download | rsyslog-d2f242edcb25e69ae7de5a142229330070f2e70b.tar.gz rsyslog-d2f242edcb25e69ae7de5a142229330070f2e70b.tar.xz rsyslog-d2f242edcb25e69ae7de5a142229330070f2e70b.zip |
Merge branch 'v4-stable' into v4-stable-solaris
Diffstat (limited to 'runtime/datetime.c')
-rw-r--r-- | runtime/datetime.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/datetime.c b/runtime/datetime.c index 7b0d8d11..eff72f91 100644 --- a/runtime/datetime.c +++ b/runtime/datetime.c @@ -793,8 +793,12 @@ int formatTimestamp3339(struct syslogTime *ts, char* pBuf) * buffer that will receive the resulting string. The function * returns the size of the timestamp written in bytes (without * the string termnator). If 0 is returend, an error occured. + * rgerhards, 2010-03-05: Added support to for buggy 3164 dates, + * where a zero-digit is written instead of a space for the first + * day character if day < 10. syslog-ng seems to do that, and some + * parsing scripts (in migration cases) rely on that. */ -int formatTimestamp3164(struct syslogTime *ts, char* pBuf) +int formatTimestamp3164(struct syslogTime *ts, char* pBuf, int bBuggyDay) { static char* monthNames[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; @@ -807,7 +811,7 @@ int formatTimestamp3164(struct syslogTime *ts, char* pBuf) pBuf[2] = monthNames[(ts->month - 1) % 12][2]; pBuf[3] = ' '; iDay = (ts->day / 10) % 10; /* we need to write a space if the first digit is 0 */ - pBuf[4] = iDay ? iDay + '0' : ' '; + pBuf[4] = (bBuggyDay || iDay > 0) ? iDay + '0' : ' '; pBuf[5] = ts->day % 10 + '0'; pBuf[6] = ' '; pBuf[7] = (ts->hour / 10) % 10 + '0'; |