Make timing outputs consistently show hours and hint at time format

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
This commit is contained in:
Josh Soref 2025-01-27 11:34:26 -05:00 committed by Eugene Yokota
parent 4ae14cf689
commit 2ee5eb7fa7
2 changed files with 13 additions and 13 deletions

View File

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

View File

@ -12,15 +12,15 @@ object AggregationSpec extends verify.BasicTestSuite {
val timing = Aggregation.timing(Aggregation.defaultFormat, 0, _: Long) val timing = Aggregation.timing(Aggregation.defaultFormat, 0, _: Long)
test("timing should format total time properly") { test("timing should format total time properly") {
assert(timing(101).startsWith("Total time: 0 s,")) assert(timing(101).startsWith("Total time: 0 s"))
assert(timing(1000).startsWith("Total time: 1 s,")) assert(timing(1000).startsWith("Total time: 1 s"))
assert(timing(3000).startsWith("Total time: 3 s,")) assert(timing(3000).startsWith("Total time: 3 s"))
assert(timing(30399).startsWith("Total time: 30 s,")) assert(timing(30399).startsWith("Total time: 30 s"))
assert(timing(60399).startsWith("Total time: 60 s,")) assert(timing(60399).startsWith("Total time: 60 s"))
assert(timing(60699).startsWith("Total time: 61 s (01:01),")) assert(timing(60699).startsWith("Total time: 61 s (0:01:01.0)"))
assert(timing(303099).startsWith("Total time: 303 s (05:03),")) assert(timing(303099).startsWith("Total time: 303 s (0:05:03.0)"))
assert(timing(6003099).startsWith("Total time: 6003 s (01:40:03),")) assert(timing(6003099).startsWith("Total time: 6003 s (01:40:03.0)"))
assert(timing(96003099).startsWith("Total time: 96003 s (26:40:03),")) assert(timing(96003099).startsWith("Total time: 96003 s (26:40:03.0)"))
} }
test("timing should not emit special space characters") { test("timing should not emit special space characters") {