From b66076544f322159308570ae8c238d9f49a8b5d2 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Fri, 29 Sep 2023 21:16:26 +0200 Subject: Added toggle for 12hr/24hr in real time hud (#511) Added toggle for 12hr/24hr in real time hud #511 --- src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt index 4f23411a0..6e6aa029f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt @@ -20,7 +20,8 @@ class TimeFeatures { private val config get() = SkyHanniMod.feature.gui private val winterConfig get() = SkyHanniMod.feature.event.winter - private val format = SimpleDateFormat("HH:mm:ss") + private val timeFormat24h = SimpleDateFormat("HH:mm:ss") + private val timeFormat12h = SimpleDateFormat("hh:mm:ss a") private val startOfNextYear = RecalculatingValue(1.seconds) { SkyBlockTime(year = SkyBlockTime.now().year + 1).asTimeMark() @@ -31,7 +32,8 @@ class TimeFeatures { if (!LorenzUtils.inSkyBlock) return if (config.realTime) { - config.realTimePosition.renderString(format.format(System.currentTimeMillis()), posLabel = "Real Time") + val currentTime = (if (config.realTimeFormatToggle) timeFormat12h else timeFormat24h).format(System.currentTimeMillis()) + config.realTimePosition.renderString(currentTime, posLabel = "Real Time") } if (winterConfig.islandCloseTime && IslandType.WINTER.isInIsland()) { -- cgit