diff options
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt index 3af450db4..e1431350e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt @@ -36,13 +36,12 @@ object TimeUtils { for ((unit, value) in parts) { if (value != 0 || (unit == TimeUnit.SECOND && showMilliSeconds)) { val formatted = value.addSeparators() - val formattedMillis = (millis / 100).toInt() - val name = unit.getName(value, longName) - val text = if (unit == TimeUnit.SECOND && showMilliSeconds) { + val formattedMillis = (millis / 100).toInt() "$formatted.$formattedMillis" } else formatted + val name = unit.getName(value, longName) append("$text$name ") if (maxUnits != -1 && ++currentUnits == maxUnits) break } @@ -58,8 +57,7 @@ object TimeUtils { else -> default } - val Duration.inWholeTicks: Int - get() = (inWholeMilliseconds / 50).toInt() + val Duration.inWholeTicks: Int get() = (inWholeMilliseconds / 50).toInt() fun getDuration(string: String) = getMillis(string.replace("m", "m ").replace(" ", " ").trim()) @@ -96,13 +94,9 @@ object TimeUtils { seconds + minutes } - 1 -> { - split[0].toInt() * 1000 - } + 1 -> split[0].toInt() * 1000 - else -> { - throw RuntimeException("Invalid format: '$string'") - } + else -> throw RuntimeException("Invalid format: '$string'") }.milliseconds } |