fix a bug that time duration may be 0 when downloading model binary
authorgdh1995 <gdh1995@qq.com>
Tue, 10 Nov 2015 14:41:55 +0000 (22:41 +0800)
committergdh1995 <gdh1995@qq.com>
Wed, 11 Nov 2015 10:49:03 +0000 (18:49 +0800)
scripts/download_model_binary.py

index 03a50f6..66f72f2 100755 (executable)
@@ -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)