From ffb1cedfb6d0adec0f85fbd97b10ce69b7ec9cf8 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Wed, 2 Oct 2024 12:36:50 +0200 Subject: [PATCH] resolve some things Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> --- .../at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt b/src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt index 789ce9324831..1ac0434d3362 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ComputerTimeOffset.kt @@ -19,8 +19,7 @@ import kotlin.time.Duration.Companion.seconds @SkyHanniModule object ComputerTimeOffset { - var offsetMillis: Duration? = null - private set + private var offsetMillis: Duration? = null private var lastCheckTime = SimpleTimeMark.farPast() @@ -31,6 +30,7 @@ object ComputerTimeOffset { OSUtils.isWindows -> @Suppress("ktlint:standard:max-line-length") "https://support.microsoft.com/en-us/windows/how-to-set-your-time-and-time-zone-dfaa7122-479f-5b98-2a7b-fa0b6e01b261" + OSUtils.isLinux -> "https://unix.stackexchange.com/a/79116" OSUtils.isMac -> "https://support.apple.com/guide/mac-help/set-the-date-and-time-automatically-mchlp2996/mac" else -> null @@ -84,8 +84,8 @@ object ComputerTimeOffset { val expectedDuration = 1.seconds val deviation = timeDifference - expectedDuration - if (deviation.absoluteValue > 1.seconds && config) { - ChatUtils.chat("Time Offset changed from ${lastDetectedOffset.format()} to ${deviation.format()}") + if (deviation.absoluteValue > 1.seconds) { + lastCheckTime = SimpleTimeMark.farPast() } lastDetectedOffset = deviation } @@ -97,7 +97,8 @@ object ComputerTimeOffset { if (offsetMillis.absoluteValue < 5.seconds) return ChatUtils.clickableLinkChat( - "Your computer's clock is off by ${offsetMillis.format()}. Please update your time settings. Click here for instructions.", + "Your computer's clock is off by ${offsetMillis.absoluteValue.format()}. " + + "Please update your time settings. Click here for instructions.", offsetFixLinks ?: return, prefixColor = "§c", )