Fix incorrect speed calculation

This commit is contained in:
Davide Depau 2018-08-15 18:10:39 +02:00
parent 2094aebfa8
commit 295caf58ef
Signed by: depau
GPG key ID: C7D999B6A55EFE86

View file

@ -81,7 +81,7 @@ abstract class UsbWriteService(name: String) : IntentService(name) {
if (time <= prevTime + 1000)
return
val speed = ((bytes - prevBytes).toDouble() / (time - prevTime).toDouble()).toHRSize()
val speed = ((bytes - prevBytes).toDouble() / (time - prevTime).toDouble() * 1000).toHRSize()
prevTime = time
prevBytes = bytes
@ -104,7 +104,7 @@ abstract class UsbWriteService(name: String) : IntentService(name) {
.setContentText("$usbDevice may have been unplugged while writing.")
.setSubText(dt.toHRTime())
else {
val speed = (dt.toDouble() / bytes.toDouble()).toHRSize() + "/s"
val speed = (bytes.toDouble() / dt.toDouble() * 1000).toHRSize() + "/s"
b.setContentTitle("Write finished")
.setContentText("$filename successfully written to $usbDevice")
.setSubText("${dt.toHRTime()}${bytes.toHRSize()}$speed")