From 193a639b2481eba4a6b881a53ac3ff6c5faab410 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 23 Nov 2005 17:44:58 +0000 Subject: fixed a bug in RFC3339 timestamp generation; added support for 3339 timestamps in internally-generated messages --- NEWS | 4 ++++ syslogd.c | 8 ++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 85360a11..bfc8af1f 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ --------------------------------------------------------------------------- Version 1.12.2 (RGer), 2005-11-?? +- fixed a bug in the RFC 3339 date formater. An extra space was added + after the actual timestamp +- added support for providing high-precision RFC3339 timestamps for + (rsyslogd-)internally-generated messages --------------------------------------------------------------------------- Version 1.12.1 (RGer), 2005-11-23 - made multithreading work with BSD. Some signal-handling needed to be diff --git a/syslogd.c b/syslogd.c index 9a8221d9..cf9871f9 100644 --- a/syslogd.c +++ b/syslogd.c @@ -1838,7 +1838,7 @@ static int formatTimestamp3339(struct syslogTime *ts, char* pBuf, size_t iLenBuf char szFmtStr[64]; /* be careful: there is ONE actual %d in the format string below ;) */ snprintf(szFmtStr, sizeof(szFmtStr), - "%%04d-%%02d-%%02dT%%02d:%%02d:%%02d.%%0%dd%%c%%02d:%%02d ", + "%%04d-%%02d-%%02dT%%02d:%%02d:%%02d.%%0%dd%%c%%02d:%%02d", ts->secfracPrecision); iRet = snprintf(pBuf, iLenBuf, szFmtStr, ts->year, ts->month, ts->day, ts->hour, ts->minute, ts->second, ts->secfrac, @@ -1846,7 +1846,7 @@ static int formatTimestamp3339(struct syslogTime *ts, char* pBuf, size_t iLenBuf } else iRet = snprintf(pBuf, iLenBuf, - "%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2d%c%2.2d:%2.2d ", + "%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2d%c%2.2d:%2.2d", ts->year, ts->month, ts->day, ts->hour, ts->minute, ts->second, ts->OffsetMode, ts->OffsetHour, ts->OffsetMinute); @@ -3730,10 +3730,6 @@ void logmsg(int pri, struct msg *pMsg, int flags) (void) time(&now); if (flags & ADDDATE) { getCurrTime(&(pMsg->tTIMESTAMP)); /* use the current time! */ - /* but modify it to be an RFC 3164 time... */ - pMsg->tTIMESTAMP.timeType = 1; - pMsg->tTIMESTAMP.secfracPrecision = 0; - pMsg->tTIMESTAMP.secfrac = 0; } /* parse HOSTNAME - but only if this is network-received! -- cgit v1.2.3