From: gdh1995 Date: Tue, 10 Nov 2015 14:41:55 +0000 (+0800) Subject: fix a bug that time duration may be 0 when downloading model binary X-Git-Tag: submit/tizen/20180823.020014~277^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f9970c83264b43722bd9f97376580cc3dbf61227;p=platform%2Fupstream%2Fcaffeonacl.git fix a bug that time duration may be 0 when downloading model binary --- diff --git a/scripts/download_model_binary.py b/scripts/download_model_binary.py index 03a50f6..66f72f2 100755 --- a/scripts/download_model_binary.py +++ b/scripts/download_model_binary.py @@ -18,7 +18,7 @@ def reporthook(count, block_size, total_size): if count == 0: start_time = time.time() return - duration = time.time() - start_time + duration = (time.time() - start_time) or 0.01 progress_size = int(count * block_size) speed = int(progress_size / (1024 * duration)) percent = int(count * block_size * 100 / total_size)