Fake usec timestamp for RFC3164 messages

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg 2022-06-05 16:42:51 +02:00
parent 1e9f164198
commit 8f83328850

View File

@ -1157,8 +1157,13 @@ parsemsg_rfc3164(const char *from, int pri, char *msg)
*/ */
if (strptime(msg, RFC3164_DATEFMT, &tm_parsed) == if (strptime(msg, RFC3164_DATEFMT, &tm_parsed) ==
msg + RFC3164_DATELEN && msg[RFC3164_DATELEN] == ' ') { msg + RFC3164_DATELEN && msg[RFC3164_DATELEN] == ' ') {
struct timeval tv;
msg += RFC3164_DATELEN + 1; msg += RFC3164_DATELEN + 1;
if (gettimeofday(&tv, NULL))
tv.tv_usec = 0;
if (!RemoteAddDate) { if (!RemoteAddDate) {
time_t t_now, t_remote; time_t t_now, t_remote;
struct tm tm_now; struct tm tm_now;
@ -1192,6 +1197,8 @@ parsemsg_rfc3164(const char *from, int pri, char *msg)
} }
buffer.timestamp = timestamp_remote; buffer.timestamp = timestamp_remote;
} }
buffer.timestamp.usec = tv.tv_usec;
} }
/* /*