mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Document print_percentage.
This commit is contained in:
parent
4aea3747e3
commit
bb0194c6e7
@ -1,3 +1,7 @@
|
|||||||
|
2005-06-28 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
|
* progress.c (print_percentage): Round the percentage value.
|
||||||
|
|
||||||
2005-06-28 Hrvoje Niksic <hniksic@xemacs.org>
|
2005-06-28 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
* ftp.c (getftp): Delete trailing newlines from LIST output so
|
* ftp.c (getftp): Delete trailing newlines from LIST output so
|
||||||
|
@ -258,7 +258,13 @@ dot_create (wgint initial, wgint total)
|
|||||||
static void
|
static void
|
||||||
print_percentage (wgint bytes, wgint expected)
|
print_percentage (wgint bytes, wgint expected)
|
||||||
{
|
{
|
||||||
int percentage = (int)(100.0 * bytes / expected);
|
/* This intentionally rounds to the floor value because it is a
|
||||||
|
measure of how much data *has* been retrieved. Therefore 12.8%
|
||||||
|
rounds to 12% because the 13% mark has not yet been reached.
|
||||||
|
Likewise, 100% is only shown when all data has been retrieved,
|
||||||
|
not before. */
|
||||||
|
|
||||||
|
int percentage = 100.0 * bytes / expected;
|
||||||
logprintf (LOG_VERBOSE, "%3d%%", percentage);
|
logprintf (LOG_VERBOSE, "%3d%%", percentage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,7 +760,7 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
|
|||||||
/* "xx% " */
|
/* "xx% " */
|
||||||
if (bp->total_length > 0)
|
if (bp->total_length > 0)
|
||||||
{
|
{
|
||||||
int percentage = (int)(100.0 * size / bp->total_length);
|
int percentage = 100.0 * size / bp->total_length;
|
||||||
assert (percentage <= 100);
|
assert (percentage <= 100);
|
||||||
|
|
||||||
if (percentage < 100)
|
if (percentage < 100)
|
||||||
@ -980,7 +986,12 @@ progress_handle_sigwinch (int sig)
|
|||||||
and hours are shown. This ensures brevity while still displaying
|
and hours are shown. This ensures brevity while still displaying
|
||||||
as much as possible.
|
as much as possible.
|
||||||
|
|
||||||
It never occupies more than 7 characters of screen space. */
|
If SEP is false, the separator between minutes and seconds (and
|
||||||
|
hours and minutes, etc.) is not included, shortening the display by
|
||||||
|
one additional character. This is used for dot progress.
|
||||||
|
|
||||||
|
The display never occupies more than 7 characters of screen
|
||||||
|
space. */
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
eta_to_human_short (int secs)
|
eta_to_human_short (int secs)
|
||||||
@ -988,9 +999,9 @@ eta_to_human_short (int secs)
|
|||||||
static char buf[10]; /* 8 should be enough, but just in case */
|
static char buf[10]; /* 8 should be enough, but just in case */
|
||||||
static int last = -1;
|
static int last = -1;
|
||||||
|
|
||||||
/* Trivial optimization. This function can be called every 200
|
/* Trivial optimization. create_image can call us every 200 msecs
|
||||||
msecs (see bar_update) for fast downloads, but ETA will only
|
(see bar_update) for fast downloads, but ETA will only change
|
||||||
change once per 900 msecs (see create_image). */
|
once per 900 msecs. */
|
||||||
if (secs == last)
|
if (secs == last)
|
||||||
return buf;
|
return buf;
|
||||||
last = secs;
|
last = secs;
|
||||||
|
Loading…
Reference in New Issue
Block a user