Skip to content

cli: logs: reconstruct wall-clock timestamps - #622

Merged
qdeslandes merged 1 commit into
meta:mainfrom
qdeslandes:wall-clock-logs
Oct 28, 2026
Merged

qdeslandes merged 1 commit into
meta:mainfrom
qdeslandes:wall-clock-logs

Conversation

@qdeslandes

Copy link
Copy Markdown
Contributor

Summary

bfcli chain logs interprets monotonic timestamps as Unix time.
Reconstruct each event's wall time from its monotonic age before
formatting it in the local timezone. Propagate clock errors through the
log reader.

Related issue

No linked issue. Log entries currently display time since boot as a
wall-clock timestamp.

Testing

Full test suite passed.

Notes for the reviewer

Producer timestamps remain monotonic nanoseconds for existing readers.
The conversion uses the clock relationship at read time, so clock steps
or suspend can shift buffered timestamps.

AI disclosure

  • AI assisted, full human review and ownership.

Checklist

  • I understand every line in this PR and can explain why it is correct
  • I built the project and ran the tests covering this change
  • make -C $BUILD test_bin test passes and the code follows the style guide
  • Commits are formatted as component: subcomponent: short description
  • I have disclosed any AI usage above

BPF log records contain monotonic nanoseconds, but bfcli passes them
directly to localtime() as seconds since the Unix epoch. This displays
uptime as a time of day.

Subtract the event's monotonic age from the current wall-clock time
before formatting. Keep the producer's timestamp format unchanged so
existing readers remain compatible, and propagate clock errors through
the ring-buffer callback.
@meta-cla meta-cla Bot added the cla signed label Oct 28, 2026
@qdeslandes
qdeslandes merged commit 37086c9 into meta:main Oct 28, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant