File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
src/commonMain/kotlin/spp.protocol/utils Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -49,22 +49,22 @@ fun Double.fromPerSecondToPrettyFrequency(translate: (String)->String = { it }):
4949 }
5050}
5151
52- fun Long.toPrettyDuration (): String {
52+ fun Long.toPrettyDuration (translate : ( String ) -> String = { it } ): String {
5353 val days = this / 86400000.0
5454 if (days > 1 ) {
55- return " ${days.toInt()} d "
55+ return " ${days.toInt()} " + translate( " dys " )
5656 }
5757 val hours = this / 3600000.0
5858 if (hours > 1 ) {
59- return " ${hours.toInt()} h "
59+ return " ${hours.toInt()} " + translate( " hrs " )
6060 }
6161 val minutes = this / 60000.0
6262 if (minutes > 1 ) {
63- return " ${minutes.toInt()} m "
63+ return " ${minutes.toInt()} " + translate( " mins " )
6464 }
6565 val seconds = this / 1000.0
6666 if (seconds > 1 ) {
67- return " ${seconds.toInt()} s "
67+ return " ${seconds.toInt()} " + translate( " secs " )
6868 }
69- return " ${ this } ms"
69+ return " $this " + translate( " ms" )
7070}
You can’t perform that action at this time.
0 commit comments