diff --git a/core/src/main/groovy/com/muwire/core/download/DownloadSession.groovy b/core/src/main/groovy/com/muwire/core/download/DownloadSession.groovy index 5733b2cd..cff4189a 100644 --- a/core/src/main/groovy/com/muwire/core/download/DownloadSession.groovy +++ b/core/src/main/groovy/com/muwire/core/download/DownloadSession.groovy @@ -236,9 +236,7 @@ class DownloadSession { if (idx == SAMPLES - 1) return reads[idx] - long interval = timestamps.last - timestamps[idx] - if (interval == 0) - interval = 1 + long interval = Math.max(1000,timestamps.last - timestamps[idx]) for (int i = idx; i < SAMPLES; i++) totalRead += reads[idx] (int)(totalRead * 1000.0 / interval)