Use ticks to decide date precision - #1856
Merged
Merged
Conversation
GetJsonDatePart and GetParameterDatePart used the Second and Millisecond properties to decide how much of the time to render, but sub-millisecond ticks leave both of those zero. So a value one tick past midnight rendered as a plain date, and AddTicks(1) and AddTicks(2) rendered identically. As parameters that means two cases sharing one snapshot prefix, surfacing as a spurious "prefix has already been used" or as both cases silently sharing one verified file. The checks are now remainder-of-ticks based, so anything below the rendered precision falls through to the FFFFFFF format.
This was referenced Aug 26, 2026
This was referenced Aug 28, 2026
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.
GetJsonDatePart/GetParameterDatePart(both theDateTimeandDateTimeOffsetvariants) used theSecondandMillisecondproperties to decide how much of the time component to render. Sub-millisecond ticks leave both of those zero, so:new DateTime(2000, 10, 1).AddTicks(1)rendered as2000-10-01, dropping the tick entirely.AddTicks(1)andAddTicks(2)rendered identically.As parameters that means two distinct cases sharing one snapshot prefix, which surfaces either as a spurious "prefix has already been used" or as both cases silently sharing one verified file.
The checks are now remainder-of-ticks based (
ticks % TimeSpan.TicksPerMinute,ticks % TimeSpan.TicksPerSecond), so any value below the rendered precision falls through to theFFFFFFFformat. Values that land exactly on a second or minute render as before, so existing snapshots are unaffected.Tests:
SubMillisecondTicksDoNotCollidepins the collision, andSubMillisecondTickssnapshots both types across tick offsets spanning the boundaries.Verify.Tests(1301),ApplyScrubbersTestsandStaticSettingsTestsall pass.