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. */
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;
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
{
sprintf (buf, "%ds", secs);
else if (secs < 100 * 60)
sprintf (buf, "%dm%s%ds", secs / 60, space, secs % 60);
- else if (secs < 100 * 3600)
+ else if (secs < 48 * 3600)
sprintf (buf, "%dh%s%dm", secs / 3600, space, (secs / 60) % 60);
else if (secs < 100 * 86400)
sprintf (buf, "%dd%s%dh", secs / 86400, space, (secs / 3600) % 60);