From 212eb1ddafc345c3cb127cdd984ccfa73c9e7932 Mon Sep 17 00:00:00 2001 From: hniksic Date: Fri, 23 Nov 2001 18:38:47 -0800 Subject: [PATCH] [svn] Fake a miniscule amount of download time when none is detected. --- src/ChangeLog | 5 +++++ src/progress.c | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index f71b7b9b..4fd1e271 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2001-11-24 Hrvoje Niksic + + * progress.c (bar_finish): If the timer didn't record any time + since the download beginning, fake 1ms. + 2001-11-24 Hrvoje Niksic * recur.c (recursive_retrieve): Fix typo. diff --git a/src/progress.c b/src/progress.c index 929aa560..a69433f9 100644 --- a/src/progress.c +++ b/src/progress.c @@ -439,8 +439,15 @@ static void bar_finish (void *progress) { struct bar_progress *bp = progress; + long elapsed = wtimer_elapsed (bp->timer); - create_image (bp, wtimer_elapsed (bp->timer)); + if (elapsed == 0) + /* If the download was faster than the granularity of the timer, + fake some output so that we don't get the ugly "----.--" rate + at the download finish. */ + elapsed = 1; + + create_image (bp, elapsed); display_image (bp->buffer); logputs (LOG_VERBOSE, "\n\n"); -- 2.39.2