Repository navigation
Conversation
The `<testsuite timestamp>` attribute was serialized with `DateTime.ToString("s")`,
which emits the date-time with no UTC offset. Because `StartTime` is captured as
`DateTime.UtcNow`, consumers received a UTC wall-clock value that looks like local
time, so a run cannot be pinned to an unambiguous instant and elapsed wall-clock
time is wrong whenever the consumer's timezone differs from the producer's.
Format the timestamp with an explicit offset (`yyyy-MM-ddTHH:mm:sszzz`,
InvariantCulture). With the existing `DateTime.UtcNow` start time this now emits
`...+00:00`, an unambiguous instant that is independent of the runner's timezone,
while keeping the same wall-clock digits as before. The JUnit XSD in this repo
types `timestamp` as `xs:string`, so the offset remains schema-valid.
Add a unit test asserting the serialized timestamp carries the offset.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
The JUnit
<testsuite timestamp>is serialized withDateTime.ToString("s"), which drops the offset:timestamp="2024-01-15T10:30:00". SinceStartTimeisDateTime.UtcNow, that string is UTC with nothing marking it as UTC, so a consumer in another timezone reads it as local time — ambiguous.Change
Format with an explicit offset,
yyyy-MM-ddTHH:mm:sszzz(InvariantCulture):Same digits as before, plus the offset.
zzzappends the offset rather than"o"(which would also inject 7-digit fractional seconds).InvariantCultureguarantees the ISO:separator regardless of runner locale.test/assets/JUnit.xsdtypestimestampasxs:string, so it stays schema-valid and the existing XSD acceptance tests pass.Tests
Added
TestSuiteTimestampShouldBeTimezoneAware.dotnet testforJUnit.Xml.TestLogger.UnitTestspasses (15/15).🤖 Generated with Claude Code