You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This updates WSL container events to keep Docker’s nanosecond timestamps and display them in Docker’s timestamp format. UTC timestamps now use Z, and timestamps keep all nine fractional digits.
PR Checklist
Closes: Link to issue #xxx
Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
Tests: Added/updated if needed and all pass
Localization: All end user facing strings can be localized
Dev docs: Added/updated if needed
Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx
Detailed Description of the Pull Request / Additional comments
Docker provides both time and timeNano for events. WSL was only keeping the seconds value, which caused the CLI to lose timestamp precision.
This change carries timeNano through event tracking and storage, then uses it when formatting event timestamps. Existing seconds-based filtering and state tracking are unchanged. Volume and process event callbacks were updated to carry the same timestamp information consistently.
The output now follows Docker’s format, including nine fractional digits and Z for UTC timestamps.
Network event test does not verify nanosecond timestamp precision
test/windows/WSLCTests.cpp:7518
This positive-value check does not verify the network timestamp change: it also passes if a callback forwards Docker's seconds-valued time, or if the stored value loses its fractional nanoseconds. The container lifecycle test compares each stored timeNano with Docker's TimeNano; please make the same comparison for at least one network event (matched by network and action) so a network-only precision regression fails this test.
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🔵 Needs a closer look
The cross-component timestamp path needs Windows integration validation, and the remaining issues need fixes.
Review effort: Balanced Findings: None
Previously missed (2)
In code that hasn't changed since last review
Prevent nanosecond overflow when applying UTC offsets
src/windows/common/timestamp.cpp:322
time uses signed 64-bit nanoseconds, so adding a local UTC offset here can overflow even when timeNano itself is valid (for example, a time near the upper limit with a +14:00 offset). The CLI can then print a date centuries earlier. Apply the offset to whole seconds and format the nine fractional digits separately; cover both timestamp limits in the formatter tests.
Use timed cancellation when reading events
test/windows/WSLCTests.cpp:7410
ReadEvents passes a null cancellation handle to GetNext. If any of these five events is missing or skipped, the stream waits until its year-3000 until bound instead of failing the test. Keep that far-future bound to test the comparison, but pass a short, timed cancellation handle to each read and fail if it expires.
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🔵 Needs a closer look
Historical time-zone offsets containing seconds can make a formatted event timestamp identify the wrong instant.
Review effort: Balanced Findings: None
Previously missed (1)
In code that hasn't changed since last review
Historical sub-minute offsets produce incorrect timestamp suffix
src/windows/common/timestamp.cpp:330
Historical time zones can have offsets with seconds (for example, +00:19:32). Here the clock is shifted by the full offset, but the suffix at line 330 prints only minutes, so the timestamp describes a different instant. Shift the clock by the same whole-minute offset printed in the suffix, and use Z if that offset becomes zero. Add a test for a sub-minute offset.
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
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.
Summary of the Pull Request
This updates WSL container events to keep Docker’s nanosecond timestamps and display them in Docker’s timestamp format. UTC timestamps now use Z, and timestamps keep all nine fractional digits.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Docker provides both time and timeNano for events. WSL was only keeping the seconds value, which caused the CLI to lose timestamp precision.
This change carries timeNano through event tracking and storage, then uses it when formatting event timestamps. Existing seconds-based filtering and state tracking are unchanged. Volume and process event callbacks were updated to carry the same timestamp information consistently.
The output now follows Docker’s format, including nine fractional digits and Z for UTC timestamps.
Validation Steps Performed