GNU Wget is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
GNU Wget is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with Wget; if not, write to the Free Software Foundation, Inc.,
-51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+along with Wget. If not, see <http://www.gnu.org/licenses/>.
In addition, as a special exception, the Free Software Foundation
gives permission to link the code of its release of Wget with the
wgint bytes_remaining = dp->total_length - bytes_displayed;
/* The quantity downloaded in this download run. */
wgint bytes_sofar = bytes_displayed - dp->initial_length;
- int eta = (int) (dltime * bytes_remaining / bytes_sofar + 0.5);
- logprintf (LOG_VERBOSE, " %s", eta_to_human_short (eta, true));
+ double eta = dltime * bytes_remaining / bytes_sofar;
+ if (eta < INT_MAX - 1)
+ logprintf (LOG_VERBOSE, " %s",
+ eta_to_human_short ((int) (eta + 0.5), true));
}
}
else
I found that doing that results in a very jerky and
ultimately unreliable ETA. */
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_time = dl_total_time;
}
}
else if (bp->total_length > 0)
{
+ skip_eta:
APPEND_LITERAL (" ");
}
}