Skip to content

Commit

Permalink
logs-show: do not use _SOURCE_MONOTONIC_TIMESTAMP field
Browse files Browse the repository at this point in the history
The timestamp is not in CLOCK_MONOTONIC, but CLOCK_BOOTTIME,
while header monotonic timestamp is in CLOCK_MONOTONIC. Hence, we cannot
adjust timestamp by comparing with header monotonic timestamp and
_SOURCE_MONOTONIC_TIMESTAMP field.

Fixes a regression caused by affde1d.
Fixes systemd#33293.

(cherry picked from commit 144498e)
  • Loading branch information
yuwata authored and keszybz committed Jun 18, 2024
1 parent f8f669f commit 34ba18b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/shared/logs-show.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@ static void parse_display_realtime(
assert(j);
assert(ret);

// FIXME: _SOURCE_MONOTONIC_TIMESTAMP is in CLOCK_BOOTTIME, hence we cannot use it for adjusting realtime.
source_monotonic = NULL;

/* First, try _SOURCE_REALTIME_TIMESTAMP. */
if (source_realtime && safe_atou64(source_realtime, &t) >= 0 && VALID_REALTIME(t)) {
*ret = t;
Expand Down Expand Up @@ -488,6 +491,9 @@ static void parse_display_timestamp(
assert(ret_display_ts);
assert(ret_boot_id);

// FIXME: _SOURCE_MONOTONIC_TIMESTAMP is in CLOCK_BOOTTIME, hence we cannot use it for adjusting realtime.
source_monotonic = NULL;

if (source_realtime && safe_atou64(source_realtime, &t) >= 0 && VALID_REALTIME(t))
source_ts.realtime = t;

Expand Down

0 comments on commit 34ba18b

Please sign in to comment.