summaryrefslogtreecommitdiffstats
path: root/src/journal
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-06-19 17:07:36 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-06-19 17:10:12 +0200
commit461e4656e7240eb515334dfb919da7f2d018cbb2 (patch)
tree56d806644133804006881f1f57de135174a71f9f /src/journal
parentupdate TODO (diff)
downloadsystemd-461e4656e7240eb515334dfb919da7f2d018cbb2.tar.xz
systemd-461e4656e7240eb515334dfb919da7f2d018cbb2.zip
journal: drop mapping from CLOCK_BOOTTIME -> CLOCK_MONOTONIC
This partially reverts commit a9357c2ce2d188b5b63592fd271f14d335867c23. Some kmsg sent before sleep may be received by systemd-journald after sleep. In that case, map_clock_usec() does not provide correct timestamp. So, we cannot provide reliable _SOURCE_MONOTONIC_TIMESTAMP.
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journald-kmsg.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
index 4123fda5f9..95135decaa 100644
--- a/src/journal/journald-kmsg.c
+++ b/src/journal/journald-kmsg.c
@@ -258,11 +258,9 @@ void dev_kmsg_record(Server *s, char *p, size_t l) {
iovec[n++] = IOVEC_MAKE_STRING(source_boot_time);
/* Historically, we stored the timestamp 'usec' as _SOURCE_MONOTONIC_TIMESTAMP, so we cannot remove
- * the field as it is already used in other projects. So, let's store the correct timestamp here by
- * mapping the boottime to monotonic. Then, the existence of _SOURCE_BOOTTIME_TIMESTAMP indicates
- * the reliability of _SOURCE_MONOTONIC_TIMESTAMP field. */
+ * the field as it is already used in other projects. This is for backward compatibility. */
char source_monotonic_time[STRLEN("_SOURCE_MONOTONIC_TIMESTAMP=") + DECIMAL_STR_MAX(unsigned long long)];
- xsprintf(source_monotonic_time, "_SOURCE_MONOTONIC_TIMESTAMP="USEC_FMT, map_clock_usec(usec, CLOCK_BOOTTIME, CLOCK_MONOTONIC));
+ xsprintf(source_monotonic_time, "_SOURCE_MONOTONIC_TIMESTAMP=%llu", usec);
iovec[n++] = IOVEC_MAKE_STRING(source_monotonic_time);
iovec[n++] = IOVEC_MAKE_STRING("_TRANSPORT=kernel");