feat: calculate boot time correctly if the time jumps#13
Merged
Conversation
Instead of capturing boot time difference with `time.Now()` just once at the beginning of streaming kmsg events, re-check the `time.Now()` while processing each message. This fixes issue with kmsg logs as seens e.g. from RPi: as it has not RTC, it might streaming ksmg logs while time is back at zero (1970), but as NTP catches up, the stream still reports dates in 1970, not accepting the fact that the NTP caught up. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
Fix linting issues. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
There was a problem hiding this comment.
Pull request overview
This PR aims to fix kernel message timestamp calculation when the system wall clock changes during a /dev/kmsg stream (e.g., devices without RTC that later sync via NTP), and also includes a broad regeneration/upgrade of project tooling and CI configuration.
Changes:
- Rework boot-time handling in the reader to use a boot-time offset and re-evaluate
time.Now()while parsing messages. - Upgrade Go/module dependencies and refresh lint/tooling configuration (Dockerfile, Makefile, golangci-lint config).
- Migrate/refresh CI and repo automation (GitHub Actions workflows added/updated, Drone pipeline removed) and add a govulncheck wrapper script.
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| writer.go | Formatting-only whitespace adjustment. |
| utils_linux.go | Replace getBootTime() with getBootTimeOffset() based on uptime. |
| utils_bsd.go | Replace getBootTime() with getBootTimeOffset() based on kern.boottime. |
| reader.go | Store boot offset and compute boot time during message parsing. |
| reader_test.go | Minor whitespace adjustments in the follow/tail test. |
| hack/release.sh | Update release script shebang and add logic to update license dates on main. |
| hack/govulncheck.sh | Add wrapper script to support govulncheck excludes/filtering. |
| go.mod | Update Go version directive and dependency versions. |
| go.sum | Update sums for upgraded dependencies. |
| Makefile | Regenerate build/lint/test/release targets and tool versions. |
| Dockerfile | Regenerate build/lint/test container pipeline; add govulncheck wrapper usage. |
| .golangci.yml | Regenerate config for newer golangci-lint schema and formatter support. |
| .dockerignore | Include new hack script in build context. |
| .conform.yaml | Regenerate policy config (notably commit policy settings). |
| .github/workflows/ci.yaml | Regenerate CI workflow and split lint/tests; update buildx setup and release action. |
| .github/workflows/slack-notify.yaml | Update Slack notification workflow/action version and payload structure. |
| .github/workflows/slack-notify-ci-failure.yaml | Add dedicated Slack notification for CI failures on main. |
| .github/workflows/stale.yml | Add stale issue/PR management workflow. |
| .github/workflows/lock.yml | Add issue lock workflow. |
| .github/renovate.json | Add Renovate configuration. |
| .drone.yml | Remove legacy Drone CI pipelines. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dsseng
approved these changes
Mar 13, 2026
Member
Author
|
/m |
smira
added a commit
to smira/talos
that referenced
this pull request
Mar 16, 2026
See siderolabs/go-kmsg#13 Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
smira
added a commit
to smira/talos
that referenced
this pull request
Mar 18, 2026
See siderolabs/go-kmsg#13 Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com> (cherry picked from commit c8a674a)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of capturing boot time difference with
time.Now()just once atthe beginning of streaming kmsg events, re-check the
time.Now()whileprocessing each message.
This fixes issue with kmsg logs as seens e.g. from RPi: as it has not
RTC, it might streaming ksmg logs while time is back at zero (1970), but
as NTP catches up, the stream still reports dates in 1970, not accepting
the fact that the NTP caught up.