mirror of
https://github.com/mirror/wget.git
synced 2025-03-31 14:40:18 +08:00
[svn] Check for overflow when calculating ETA.
This commit is contained in:
parent
c5a4dac530
commit
8b08f41f0d
@ -1,3 +1,8 @@
|
|||||||
|
2007-01-23 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
|
* progress.c (create_image): Check for ETA overflow.
|
||||||
|
(print_row_stats): Ditto.
|
||||||
|
|
||||||
2007-01-09 Mauro Tortonesi <mauro@ferrara.linux.it>
|
2007-01-09 Mauro Tortonesi <mauro@ferrara.linux.it>
|
||||||
|
|
||||||
* init.c (cmd_spec_prefer_family): Small fix to get rid of a gcc
|
* init.c (cmd_spec_prefer_family): Small fix to get rid of a gcc
|
||||||
|
@ -320,8 +320,10 @@ print_row_stats (struct dot_progress *dp, double dltime, bool last)
|
|||||||
wgint bytes_remaining = dp->total_length - bytes_displayed;
|
wgint bytes_remaining = dp->total_length - bytes_displayed;
|
||||||
/* The quantity downloaded in this download run. */
|
/* The quantity downloaded in this download run. */
|
||||||
wgint bytes_sofar = bytes_displayed - dp->initial_length;
|
wgint bytes_sofar = bytes_displayed - dp->initial_length;
|
||||||
int eta = (int) (dltime * bytes_remaining / bytes_sofar + 0.5);
|
double eta = dltime * bytes_remaining / bytes_sofar;
|
||||||
logprintf (LOG_VERBOSE, " %s", eta_to_human_short (eta, true));
|
if (eta < INT_MAX - 1)
|
||||||
|
logprintf (LOG_VERBOSE, " %s",
|
||||||
|
eta_to_human_short ((int) (eta + 0.5), true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -932,7 +934,10 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
|
|||||||
I found that doing that results in a very jerky and
|
I found that doing that results in a very jerky and
|
||||||
ultimately unreliable ETA. */
|
ultimately unreliable ETA. */
|
||||||
wgint bytes_remaining = bp->total_length - size;
|
wgint bytes_remaining = bp->total_length - size;
|
||||||
eta = (int) (dl_total_time * bytes_remaining / bp->count + 0.5);
|
double eta_ = dl_total_time * bytes_remaining / bp->count;
|
||||||
|
if (eta_ >= INT_MAX - 1)
|
||||||
|
goto skip_eta;
|
||||||
|
eta = (int) (eta_ + 0.5);
|
||||||
bp->last_eta_value = eta;
|
bp->last_eta_value = eta;
|
||||||
bp->last_eta_time = dl_total_time;
|
bp->last_eta_time = dl_total_time;
|
||||||
}
|
}
|
||||||
@ -944,6 +949,7 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
|
|||||||
}
|
}
|
||||||
else if (bp->total_length > 0)
|
else if (bp->total_length > 0)
|
||||||
{
|
{
|
||||||
|
skip_eta:
|
||||||
APPEND_LITERAL (" ");
|
APPEND_LITERAL (" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user