At 2 minutes remaining it starts adding the seconds to the diplsayd text (local hideSeconds = timetotrun >= 120).
Lua Code:
local Backdrop = {
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
}
local frame_x = 0
local frame_y = -200
f = CreateFrame("Button", "ZAMROTimer", UIParent, "BackdropTemplate")
f:SetWidth(255)
f:SetHeight(20)
f:SetBackdrop(Backdrop)
f.text = f:CreateFontString(nil,"OVERLAY","GameTooltipText")
f.text:SetTextHeight(15)
f.text:SetPoint("CENTER")
f:SetClampedToScreen(true)
f:SetPoint("CENTER",UIParent,"CENTER",frame_x,frame_y)
f:EnableMouse(true)
f:SetMovable(true)
f:RegisterForDrag("LeftButton")
f:RegisterForClicks("AnyUp")
f:Show()
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnDragStart",function(this)
this:StartMoving()
end)
f:SetScript("OnDragStop",function(this)
this:StopMovingOrSizing()
frame_x,frame_y = this:GetCenter()
frame_x = frame_x - GetScreenWidth() / 2
frame_y = frame_y - GetScreenHeight() / 2
this:ClearAllPoints()
this:SetPoint("CENTER",UIParent,"CENTER",frame_x,frame_y)
end)
local timeToRun = 5400
local function printTime(timetotrun)
local hideSeconds = timetotrun >= 120
f.text:SetText(format("Next update in: %s", SecondsToTime(timetotrun, hideSeconds)))
end
local ticker = C_Timer.NewTicker(1, function()
if timeToRun > 0 then
timeToRun = timeToRun - 1
printTime(timeToRun)
return
end
timeToRun = 5400 -- reset timer to 90 mins
printTime(timeToRun)
-- do whatever after 1 hour 30
end)
printTime(timeToRun)