progress: narrower time display, multiple fixes

- Each time field is now 7 characters wide, so that the total width
  never exceeds 79 columns so that it works correctly also in Windows
  terminals. The title lines are adjusted accordingly.

  This is accomplished by using h:mm:ss style up to 10 hours, and for
  longer periods switch to "nnX nnY" style output. For hours, days,
  months and years.

  For less than one hour, the hour field is now dropped.

  When no time info is provided, the field is now space-only. No more
  `-:--:--`.

  Also fixed the output for really long times which previously was
  completely broken. The largest time now shows as ">99999y". (Becase
  I can't figure out a better way).

- For sizes, the widths are now properly fixed to 6 characters. When
  displaying a unit with less than 3 digits, it shows two decimal
  precision like "16777215 => 15.99M" and one decmal otherwise: "262143
  => 255.9k"

  Also fixes the decimal math. 131071 is 127.9k, which it previously did
  not show.

- The time and size field outputs are now properly verified in test
  1636.

Fixes #20122
Closes #20173

fixup use only space when no time exists

Drop the hour from the display when zero
This commit is contained in:
Daniel Stenberg 2026-01-03 12:16:06 +01:00
parent 3c8f9c9247
commit 193397bf4e
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 296 additions and 28 deletions

View file

@ -216,7 +216,7 @@ test1606 test1607 test1608 test1609 test1610 test1611 test1612 test1613 \
test1614 test1615 test1616 test1617 \
test1620 test1621 test1622 \
\
test1630 test1631 test1632 test1633 test1634 test1635 \
test1630 test1631 test1632 test1633 test1634 test1635 test1636 \
\
test1650 test1651 test1652 test1653 test1654 test1655 test1656 test1657 \
test1658 \