]> sjero.net Git - wget/commitdiff
[svn] Introduce symbolic constants for "magic" values of 0.2 and 0.9,
authorhniksic <devnull@localhost>
Thu, 1 Sep 2005 16:44:11 +0000 (09:44 -0700)
committerhniksic <devnull@localhost>
Thu, 1 Sep 2005 16:44:11 +0000 (09:44 -0700)
REFRESH_INTERVAL and ETA_REFRESH_INTERVAL.

src/ChangeLog
src/progress.c

index 4ff935951f256f23cceae13de4e4b356c565802f..1332629738321abd27306ab0d2ca8da96f6f0c5e 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-01  Hrvoje Niksic  <hniksic@xemacs.org>
+
+       * progress.c: Introduce symbolic constants for "magic" values of
+       0.2 and 0.9, REFRESH_INTERVAL and ETA_REFRESH_INTERVAL.
+
 2005-08-27  Hrvoje Niksic  <hniksic@xemacs.org>
 
        * cmpt.c (strtoll): Correctly handle strtoll("0x", ptr, 0) and
index 05a6c26f46d19ce40221efe6acff8675c7ded521..77053e7b9524133d78de8d180ac106f5984c0b74 100644 (file)
@@ -483,6 +483,14 @@ static volatile sig_atomic_t received_sigwinch;
    download speeds are scratched.  */
 #define STALL_START_TIME 5
 
+/* Time between screen refreshes will not be shorter than this, so
+   that Wget doesn't swamp the TTY with output.  */
+#define REFRESH_INTERVAL 0.2
+
+/* Don't refresh the ETA too often to avoid jerkiness in predictions.
+   This allows ETA to change approximately once per second.  */
+#define ETA_REFRESH_INTERVAL 0.99
+
 struct bar_progress {
   wgint initial_length;                /* how many bytes have been downloaded
                                   previously. */
@@ -616,7 +624,7 @@ bar_update (void *progress, wgint howmuch, double dltime)
       received_sigwinch = 0;
     }
 
-  if (dltime - bp->last_screen_update < 0.2 && !force_screen_update)
+  if (dltime - bp->last_screen_update < REFRESH_INTERVAL && !force_screen_update)
     /* Don't update more often than five times per second. */
     return;
 
@@ -913,7 +921,7 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
             any value to the user. */
          if (bp->total_length != size
              && bp->last_eta_value != 0
-             && dl_total_time - bp->last_eta_time < 0.9)
+             && dl_total_time - bp->last_eta_time < ETA_REFRESH_INTERVAL)
            eta = bp->last_eta_value;
          else
            {