]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Display ??:??:?? when a time estimate gets too big.
authorWayne Davison <wayne@opencoder.net>
Thu, 13 Jan 2022 16:11:50 +0000 (08:11 -0800)
committerWayne Davison <wayne@opencoder.net>
Thu, 13 Jan 2022 16:22:25 +0000 (08:22 -0800)
NEWS.md
progress.c

diff --git a/NEWS.md b/NEWS.md
index 4eebaa44cb76c59810cfca7e9579343c08a5b61d..959e1da7bb3f23cfc371a3d2bbc48cd01e00c3e3 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
    check to see if the allowed time is over, which should make rsync exit more
    consistently.
 
- - Tweak the snprintf() in progress.c that turns the remaining time into a
-   HHHH:MM:SS value to avoid putting a -8 into the SS or MM spots when the
-   remaining seconds is so large that it overflows the integer arithmetic
-   trying to perform a modulus.
+ - Tweak --progress to display "??:??:??" when the time-remaining value is
+   so large as to be meaningless.
 
 ### ENHANCEMENTS:
 
index 6e39ce995dc6cdfb750b81c35d6f50aef39ebcbb..6af96b98bc90c157f0e8a56c8baee064b7d6e7e7 100644 (file)
@@ -115,11 +115,11 @@ static void rprint_progress(OFF_T ofs, OFF_T size, struct timeval *now, int is_l
                units = "kB/s";
        }
 
-       if (remain < 0)
+       if (remain < 0 || remain > 9999.0 * 3600.0)
                strlcpy(rembuf, "  ??:??:??", sizeof rembuf);
        else {
-               snprintf(rembuf, sizeof rembuf, "%4lu:%02u:%02u",
-                        (unsigned long) (remain / 3600.0),
+               snprintf(rembuf, sizeof rembuf, "%4u:%02u:%02u",
+                        (unsigned int) (remain / 3600.0),
                         (unsigned int) (remain / 60.0) % 60,
                         (unsigned int) remain % 60);
        }