]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: add accessor for raw timestamp in zlog
authorDavid Lamparter <equinox@opensourcerouting.org>
Sun, 16 Jan 2022 12:20:50 +0000 (13:20 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Mon, 28 Feb 2022 12:25:47 +0000 (13:25 +0100)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/zlog.c
lib/zlog.h

index 1b0751559dc7a9a2af90d8a91386e2a65b5d70ff..85606d262405764c573fc6c4af2400362b04fb70 100644 (file)
@@ -908,6 +908,11 @@ size_t zlog_msg_ts_3164(struct zlog_msg *msg, struct fbuf *out, uint32_t flags)
        return bputs(out, msg->ts_3164_str);
 }
 
+void zlog_msg_tsraw(struct zlog_msg *msg, struct timespec *ts)
+{
+       memcpy(ts, &msg->ts, sizeof(*ts));
+}
+
 void zlog_set_prefix_ec(bool enable)
 {
        atomic_store_explicit(&zlog_ec, enable, memory_order_relaxed);
index 6e84fe892372dd6f7fdce33989ad6a426a79405e..a530c589a8e41a2d999b49cbe1a23aa15632b1ce 100644 (file)
@@ -183,8 +183,11 @@ extern void zlog_msg_args(struct zlog_msg *msg, size_t *hdrlen,
 /* default is local time zone */
 #define ZLOG_TS_UTC            (1 << 10)
 
+struct timespec;
+
 extern size_t zlog_msg_ts(struct zlog_msg *msg, struct fbuf *out,
                          uint32_t flags);
+extern void zlog_msg_tsraw(struct zlog_msg *msg, struct timespec *ts);
 
 /* "mmm dd hh:mm:ss" for RFC3164 syslog.  Only ZLOG_TS_UTC for flags. */
 extern size_t zlog_msg_ts_3164(struct zlog_msg *msg, struct fbuf *out,