Skip to content

Use ticks to decide date precision - #1856

Merged
SimonCropp merged 1 commit into
mainfrom
fix-subms-date-parameters
Aug 17, 2026
Merged

Use ticks to decide date precision#1856
SimonCropp merged 1 commit into
mainfrom
fix-subms-date-parameters

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

GetJsonDatePart / GetParameterDatePart (both the DateTime and DateTimeOffset variants) used the Second and Millisecond properties 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 as 2000-10-01, dropping the tick entirely.
  • AddTicks(1) and AddTicks(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 the FFFFFFF format. Values that land exactly on a second or minute render as before, so existing snapshots are unaffected.

Tests: SubMillisecondTicksDoNotCollide pins the collision, and SubMillisecondTicks snapshots both types across tick offsets spanning the boundaries. Verify.Tests (1301), ApplyScrubbersTests and StaticSettingsTests all pass.

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.
@SimonCropp SimonCropp added this to the 32.0.0 milestone Aug 17, 2026
@SimonCropp
SimonCropp merged commit 0c34b67 into main Aug 17, 2026
7 checks passed
@SimonCropp
SimonCropp deleted the fix-subms-date-parameters branch August 17, 2026 12:25
This was referenced Aug 26, 2026
This was referenced Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant