commit e50a30c: [Minor] Use floating point ts instead of microseconds

Vsevolod Stakhov vsevolod at rspamd.com
Mon Oct 30 17:21:06 UTC 2023


Author: Vsevolod Stakhov
Date: 2023-10-30 17:15:26 +0000
URL: https://github.com/rspamd/rspamd/commit/e50a30ca356d1d0ac4398d672853cf74707a93d4 (refs/pull/4674/head, log_json)

[Minor] Use floating point ts instead of microseconds

---
 src/libserver/logger/logger.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libserver/logger/logger.c b/src/libserver/logger/logger.c
index 33117f72f..e10dfd392 100644
--- a/src/libserver/logger/logger.c
+++ b/src/libserver/logger/logger.c
@@ -1094,7 +1094,7 @@ void rspamd_log_fill_iov(struct rspamd_logger_iov_ctx *iov_ctx,
 		/* Perform JSON logging */
 		guint slen = id ? strlen(id) : strlen("(NULL)");
 		slen = MIN(RSPAMD_LOG_ID_LEN, slen);
-		r = rspamd_snprintf(tmpbuf, sizeof(tmpbuf), "{\"ts\": %L, "
+		r = rspamd_snprintf(tmpbuf, sizeof(tmpbuf), "{\"ts\": %f, "
 													"\"pid\": %P, "
 													"\"severity\": \"%s\", "
 													"\"worker_type\": \"%s\", "
@@ -1102,7 +1102,7 @@ void rspamd_log_fill_iov(struct rspamd_logger_iov_ctx *iov_ctx,
 													"\"module\": \"%s\", "
 													"\"function\": \"%s\", "
 													"\"message\": \"",
-							(gint64) (ts * 1e6),
+							ts,
 							logger->pid,
 							rspamd_get_log_severity_string(level_flags),
 							logger->process_type,


More information about the Commits mailing list