always assume interval is at least 1 second

pull/9/head
Zlatin Balevsky 2019-07-02 12:49:00 +01:00
parent 19c2c46491
commit 79e8438941
1 changed files with 1 additions and 3 deletions

View File

@ -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)