Merge pull request #8019 from jsoref/issue-8003

Make timing outputs consistently show hours and hint at time format
This commit is contained in:
eugene yokota 2025-01-27 14:50:46 -05:00 committed by GitHub
commit 5647bab8f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View File

@ -1126,12 +1126,12 @@ object NetworkClient {
val totalString = s"$total s" +
(if (total <= 60) ""
else {
val maybeHours = total / 3600 match
case 0 => ""
case h => f"$h%02d:"
val hours = total / 3600 match
case 0 => "0"
case h => f"$h%02d"
val mins = f"${total % 3600 / 60}%02d"
val secs = f"${total % 60}%02d"
s" ($maybeHours$mins:$secs)"
s" ($hours:$mins:$secs.0)"
})
s"elapsed time: $totalString"

View File

@ -17,10 +17,10 @@ object AggregationSpec extends verify.BasicTestSuite {
assert(timing(3000).startsWith("elapsed time: 3 s"))
assert(timing(30399).startsWith("elapsed time: 30 s"))
assert(timing(60399).startsWith("elapsed time: 60 s"))
assert(timing(60699).startsWith("elapsed time: 61 s (01:01)"))
assert(timing(303099).startsWith("elapsed time: 303 s (05:03)"))
assert(timing(6003099).startsWith("elapsed time: 6003 s (01:40:03)"))
assert(timing(96003099).startsWith("elapsed time: 96003 s (26:40:03)"))
assert(timing(60699).startsWith("elapsed time: 61 s (0:01:01.0)"))
assert(timing(303099).startsWith("elapsed time: 303 s (0:05:03.0)"))
assert(timing(6003099).startsWith("elapsed time: 6003 s (01:40:03.0)"))
assert(timing(96003099).startsWith("elapsed time: 96003 s (26:40:03.0)"))
}
test("timing should not emit special space characters") {