From 7acb52394212fc4e74a03bb4a8a2b02379e3eecb Mon Sep 17 00:00:00 2001 From: Dusk-92 Date: Tue, 25 Aug 2026 22:54:57 +0200 Subject: [PATCH] Avoid per-frame clock time queries --- mods/minimap-clock.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mods/minimap-clock.lua b/mods/minimap-clock.lua index 278a24f..5325efd 100644 --- a/mods/minimap-clock.lua +++ b/mods/minimap-clock.lua @@ -32,8 +32,14 @@ module.enable = function(self) MinimapClock.text:SetFont(STANDARD_TEXT_FONT, 12, "OUTLINE") MinimapClock.text:SetAllPoints(MinimapClock) MinimapClock.text:SetFontObject(GameFontWhite) + MinimapClock.text:SetText(date("%H:%M")) + MinimapClock.elapsed = 0 MinimapClock:SetScript("OnUpdate", function() - if ( this.tick or 1) > GetTime() then return else this.tick = GetTime() + 1 end + -- OnUpdate already gives us elapsed time. The clock only needs a 1 Hz + -- refresh, so avoid calling GetTime() on every rendered frame. + this.elapsed = (this.elapsed or 0) + arg1 + if this.elapsed < 1 then return end + this.elapsed = 0 this.text:SetText(date("%H:%M")) end)