Provide duration

This commit is contained in:
Benoit Marty 2025-01-17 16:07:36 +01:00 committed by Benoit Marty
parent 98a786bfa3
commit d26414f1d3
13 changed files with 79 additions and 73 deletions

View file

@ -8,6 +8,7 @@
package io.element.android.libraries.dateformatter.api
import java.util.Locale
import kotlin.time.Duration
/**
* Convert milliseconds to human readable duration.
@ -38,3 +39,5 @@ fun Long.toHumanReadableDuration(): String {
String.format(Locale.US, "%d:%02d", minutes, seconds)
}
}
fun Duration.toHumanReadableDuration() = inWholeMilliseconds.toHumanReadableDuration()