summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-10-02 15:52:24 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-10-02 15:52:24 +0200
commit02bb3c901d9b14e8a08b111dde151f1ed4d2d1da (patch)
treea54cde6c8c8be2665aa9df16f207d32106af2750 /runtime
parent1908bae50491624d270c73609ea45634c15246fd (diff)
downloadrsyslog-02bb3c901d9b14e8a08b111dde151f1ed4d2d1da.tar.gz
rsyslog-02bb3c901d9b14e8a08b111dde151f1ed4d2d1da.tar.xz
rsyslog-02bb3c901d9b14e8a08b111dde151f1ed4d2d1da.zip
consolidated time calls during msg object creation
...this improves performance and consistency and also fixes a bug where subsecond time properties generated by imfile, imklog and internal messages could be slightly inconsistent.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/msg.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/msg.c b/runtime/msg.c
index 6c1b9ff3..9c2e3f17 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -257,7 +257,16 @@ rsRetVal msgConstruct(msg_t **ppThis)
pM->iRefCount = 1;
pM->iSeverity = -1;
pM->iFacility = -1;
+
+ /* we initialize both timestamps to contain the current time, so that they
+ * are consistent. Also, this saves us from doing any further time calls just
+ * to obtain a timestamp. The memcpy() should not really make a difference,
+ * especially as I think there is no codepath currently where it would not be
+ * required (after I have cleaned up the pathes ;)). -- rgerhards, 2008-10-02
+ */
datetime.getCurrTime(&(pM->tRcvdAt));
+ memcpy(&pM->tTIMESTAMP, &pM->tRcvdAt, sizeof(struct syslogTime));
+
objConstructSetObjInfo(pM);
/* DEV debugging only! dbgprintf("msgConstruct\t0x%x, ref 1\n", (int)pM);*/