/* Download progress.
- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+ 2010, 2011 Free Software Foundation, Inc.
This file is part of GNU Wget.
#include <stdlib.h>
#include <string.h>
#include <assert.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
+#include <unistd.h>
#include <signal.h>
#ifdef HAVE_WCHAR_H
# include <wchar.h>
if (bp->stalled)
{
bp->stalled = false;
- /* "recent_age" includes the the entired stalled period, which
+ /* "recent_age" includes the entired stalled period, which
could be very long. Don't update the speed ring with that
value because the current bandwidth would start too small.
Start with an arbitrary (but more reasonable) time value and
const char *
get_eta (int *bcd)
{
- /* Translation note: "ETA" is English-centric, but this must
+ /* TRANSLATORS: "ETA" is English-centric, but this must
be short, ideally 3 chars. Abbreviate if necessary. */
static const char eta_str[] = N_(" eta %s");
static const char *eta_trans;
struct bar_progress_hist *hist = &bp->hist;
/* The progress bar should look like this:
- xx% [=======> ] nn,nnn 12.34K/s eta 36m 51s
+ xx% [=======> ] nn,nnn 12.34KB/s eta 36m 51s
Calculate the geometry. The idea is to assign as much room as
possible to the progress bar. The other idea is to never let
"xx% " or "100%" - percentage - 4 chars
"[]" - progress bar decorations - 2 chars
" nnn,nnn,nnn" - downloaded bytes - 12 chars or very rarely more
- " 12.5K/s" - download rate - 8 chars
+ " 12.5KB/s" - download rate - 9 chars
" eta 36m 51s" - ETA - 14 chars
"=====>..." - progress bar - the rest
*p++ = ' ';
}
- /* " 12.52K/s" */
+ /* " 12.52Kb/s or 12.52KB/s" */
if (hist->total_time > 0 && hist->total_bytes)
{
- static const char *short_units[] = { "B/s", "K/s", "M/s", "G/s" };
+ static const char *short_units[] = { "B/s", "KB/s", "MB/s", "GB/s" };
+ static const char *short_units_bits[] = { "b/s", "Kb/s", "Mb/s", "Gb/s" };
int units = 0;
/* Calculate the download speed using the history ring and
recent data that hasn't made it to the ring yet. */
double dltime = hist->total_time + (dl_total_time - bp->recent_start);
double dlspeed = calc_rate (dlquant, dltime, &units);
sprintf (p, " %4.*f%s", dlspeed >= 99.95 ? 0 : dlspeed >= 9.995 ? 1 : 2,
- dlspeed, short_units[units]);
+ dlspeed, !opt.bits_fmt?short_units[units]:short_units_bits[units]);
move_to_end (p);
}
else