aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-06-16 19:17:08 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-06-16 19:17:08 +0200
commit8dd235557062826138de17e51da24f3c9c58780e (patch)
tree83f518c280126f088df9ef66b50712f05c22f27e /src/main/java/at
parentd93d586451dd4b79b023af0af8a3a680f9e7951c (diff)
downloadskyhanni-8dd235557062826138de17e51da24f3c9c58780e.tar.gz
skyhanni-8dd235557062826138de17e51da24f3c9c58780e.tar.bz2
skyhanni-8dd235557062826138de17e51da24f3c9c58780e.zip
code cleanup
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt16
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
}