tool_progress: fix large time outputs and decimal size display

Time output:

- was broken for really large times

- now uses spaces instead of --:--:--

- >99999y is now the largest shown time

- show HH:MM:SS as long as hours are fewer than 100

Size:

- made the decimal output always only use a single decimal

Test:

- Add test 1622 to verify these functions

Closes #20177
This commit is contained in:
Daniel Stenberg 2026-01-03 17:50:26 +01:00
parent 09374f6e75
commit b32e66a8ee
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
6 changed files with 270 additions and 21 deletions

View file

@ -34,6 +34,13 @@ int xferinfo_cb(void *clientp,
bool progress_meter(CURLM *multi,
struct curltime *start,
bool final);
struct per_transfer;
void progress_finalize(struct per_transfer *per);
#ifdef UNITTESTS
UNITTEST char *max5data(curl_off_t bytes, char *max5, size_t mlen);
UNITTEST void time2str(char *r, size_t rlen, curl_off_t seconds);
#endif
#endif /* HEADER_CURL_TOOL_PROGRESS_H */