Skip to content

Keep StopWatch.formatSplitTime from clamping splits to int millis - #1777

Merged
garydgregory merged 1 commit into
apache:masterfrom
alhudz:stopwatch-split-long-millis
Aug 22, 2026
Merged

Keep StopWatch.formatSplitTime from clamping splits to int millis#1777
garydgregory merged 1 commit into
apache:masterfrom
alhudz:stopwatch-split-long-millis

Conversation

@alhudz

@alhudz alhudz commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

StopWatch.formatSplitTime() feeds the split Duration through DurationUtils.toMillisInt, which clamps the millisecond value into int range. A split longer than Integer.MAX_VALUE ms (about 24.86 days) is capped, so formatDurationHMS renders the cap rather than the real elapsed time. Backdating the start by 30 days and calling split() gives formatSplitTime() = 596:31:23.647 while getSplitDuration() is PT720H (720:00:00.008).

formatDurationHMS already takes a long, and the sibling formatTime() hands it getTime() with no narrowing, so route the split path through DurationUtils.toMillisLong instead. Keeping the value a long up to the formatter is what drops the truncation, and normal-length splits are unchanged.

@garydgregory garydgregory changed the title keep StopWatch.formatSplitTime from clamping splits to int millis Keep StopWatch.formatSplitTime from clamping splits to int millis Aug 22, 2026
@garydgregory
garydgregory merged commit df5245a into apache:master Aug 22, 2026
36 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants