aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-10-01 21:37:02 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-10-01 21:37:02 +0200
commit649dc5363b26acaeac4eb1c53a7cd3ed777f0293 (patch)
treefe28feeb518ef8dfdaae045093008e8163aeb4ec /src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
parent8b2db58f5d10948eebc8d0af4b70fee725590238 (diff)
downloadskyhanni-649dc5363b26acaeac4eb1c53a7cd3ed777f0293.tar.gz
skyhanni-649dc5363b26acaeac4eb1c53a7cd3ed777f0293.tar.bz2
skyhanni-649dc5363b26acaeac4eb1c53a7cd3ed777f0293.zip
fix time format showing empty string for sub 1s
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
index 5cf3ec2e5..34b86f63e 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
@@ -34,6 +34,11 @@ object TimeUtils {
val largestNonZeroUnit = parts.firstNotNullOfOrNull { if (it.value != 0) it.key else null } ?: TimeUnit.SECOND
+ if (absoluteValue < 1.seconds) {
+ val formattedMillis = (millis / 100).toInt()
+ return "0.${formattedMillis}s"
+ }
+
var currentUnits = 0
val result = buildString {
for ((unit, value) in parts) {