summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-09-02 11:55:51 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2013-09-02 11:55:51 +0200
commit177c77ca1e3045e77853014a37e712681e175e22 (patch)
treeabf420320e9e398c0b4b8cbfd6d87ab506fad2ed
parentd11e8221a8b9592bca7f219cc3d3cf3359273ba1 (diff)
downloadrsyslog-177c77ca1e3045e77853014a37e712681e175e22.tar.gz
rsyslog-177c77ca1e3045e77853014a37e712681e175e22.tar.bz2
rsyslog-177c77ca1e3045e77853014a37e712681e175e22.zip
apply default TZ if none is present in legacy timestamp
-rw-r--r--runtime/datetime.c9
-rw-r--r--runtime/datetime.h1
-rw-r--r--tools/pmrfc3164.c3
3 files changed, 12 insertions, 1 deletions
diff --git a/runtime/datetime.c b/runtime/datetime.c
index 841ff625..3d50238c 100644
--- a/runtime/datetime.c
+++ b/runtime/datetime.c
@@ -626,6 +626,15 @@ finalize_it:
RETiRet;
}
+void
+applyDfltTZ(struct syslogTime *pTime, char *tz)
+{
+ pTime->OffsetMode = tz[0];
+ pTime->OffsetHour = (tz[1] - '0') * 10 + (tz[2] - '0');
+ pTime->OffsetMinute = (tz[4] - '0') * 10 + (tz[5] - '0');
+
+}
+
/*******************************************************************
* END CODE-LIBLOGGING *
*******************************************************************/
diff --git a/runtime/datetime.h b/runtime/datetime.h
index 9f3611e1..72c3a97f 100644
--- a/runtime/datetime.h
+++ b/runtime/datetime.h
@@ -62,5 +62,6 @@ ENDinterface(datetime)
/* prototypes */
PROTOTYPEObj(datetime);
+void applyDfltTZ(struct syslogTime *pTime, char *tz);
#endif /* #ifndef INCLUDED_DATETIME_H */
diff --git a/tools/pmrfc3164.c b/tools/pmrfc3164.c
index 23c8766c..4f469a2d 100644
--- a/tools/pmrfc3164.c
+++ b/tools/pmrfc3164.c
@@ -95,7 +95,8 @@ CODESTARTparse
if(datetime.ParseTIMESTAMP3339(&(pMsg->tTIMESTAMP), &p2parse, &lenMsg) == RS_RET_OK) {
/* we are done - parse pointer is moved by ParseTIMESTAMP3339 */;
} else if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), &p2parse, &lenMsg) == RS_RET_OK) {
-dbgprintf("DDDD: timestamp parsed, dfltTZ '%s'\n", pMsg->dfltTZ);
+ if(pMsg->dfltTZ[0] != '\0')
+ applyDfltTZ(&pMsg->tTIMESTAMP, pMsg->dfltTZ);
/* we are done - parse pointer is moved by ParseTIMESTAMP3164 */;
} else if(*p2parse == ' ' && lenMsg > 1) { /* try to see if it is slighly malformed - HP procurve seems to do that sometimes */
++p2parse; /* move over space */