[ui] use GNU wget's algorithms for rate/ETA display

This commit is contained in:
Pete Batard 2019-09-07 12:12:28 +01:00
parent 4c816a519e
commit 38ba8d366c
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
4 changed files with 215 additions and 29 deletions

View file

@ -47,10 +47,30 @@
enum update_progress_type {
UPT_PERCENT = 0,
UPT_SPEED,
UPT_TIME,
UPT_ETA,
UPT_MAX
};
// Size of the download speed history ring.
#define SPEED_HISTORY_SIZE 20
// The minimum time length of a history sample. By default, each sample is at least 150ms long,
// which means that, over the course of 20 samples, "current" download speed spans at least 3s
// into the past.
#define SPEED_SAMPLE_MIN 150
// The time after which the download starts to be considered "stalled", i.e. the current
// bandwidth is not printed and the recent download speeds are scratched.
#define STALL_START_TIME 5000
// Time between screen refreshes will not be shorter than this.
// NB: In Rufus' case, "screen" means the text overlaid on the progress bar.
#define SCREEN_REFRESH_INTERVAL 200
// 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 990
extern HWND hMultiToolbar, hSaveToolbar, hHashToolbar, hAdvancedDeviceToolbar, hAdvancedFormatToolbar;
extern HFONT hInfoFont;
extern UINT_PTR UM_LANGUAGE_MENU_MAX;