Fix incorrect speed calculation

This commit is contained in:
Davide Depau 2018-08-15 18:10:39 +02:00
parent ea9c68eaad
commit 8c158c8cef
1 changed files with 2 additions and 2 deletions

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