Skip to content

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

Open
alhudz wants to merge 1 commit into
apache:masterfrom
alhudz:stopwatch-split-long-millis
Open

keep StopWatch.formatSplitTime from clamping splits to int millis#1777
alhudz wants to merge 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.

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.

1 participant