mirror of https://github.com/zlatinb/muwire
avoid more conversions to BigDecimal
parent
244015465a
commit
fbb710cfc8
|
@ -106,7 +106,7 @@ class ContentUploader extends Uploader {
|
||||||
return done ? 100 : 0
|
return done ? 100 : 0
|
||||||
int position = mapped.position()
|
int position = mapped.position()
|
||||||
int total = request.getRange().end - request.getRange().start
|
int total = request.getRange().end - request.getRange().start
|
||||||
(int)(position * 100.0 / total)
|
(int)(position * 100.0d / total)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -45,7 +45,7 @@ class HashListUploader extends Uploader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized int getProgress() {
|
public synchronized int getProgress() {
|
||||||
(int)(mapped.position() * 100.0 / mapped.capacity())
|
(int)(mapped.position() * 100.0d / mapped.capacity())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -49,7 +49,7 @@ abstract class Uploader {
|
||||||
final long now = System.currentTimeMillis()
|
final long now = System.currentTimeMillis()
|
||||||
long interval = Math.max(1000, now - lastSpeedRead)
|
long interval = Math.max(1000, now - lastSpeedRead)
|
||||||
lastSpeedRead = now;
|
lastSpeedRead = now;
|
||||||
int currSpeed = (int) (dataSinceLastRead * 1000.0 / interval)
|
int currSpeed = (int) (dataSinceLastRead * 1000.0d / interval)
|
||||||
dataSinceLastRead = 0
|
dataSinceLastRead = 0
|
||||||
|
|
||||||
// normalize to speedArr.size
|
// normalize to speedArr.size
|
||||||
|
|
Loading…
Reference in New Issue