local MyClock = {}
MyClock.name = "MyClock"
MyClock.updateInterval = 1 -- seconds
-- Convert real time to Tamriel time
local function GetTamrielTime()
local realSeconds = GetTimeStamp()
local tamrielSeconds = realSeconds * 20
local secondsInDay = 24 * 60 * 60
local tamrielDaySeconds = tamrielSeconds % secondsInDay
local hours = math.floor(tamrielDaySeconds / 3600)
local minutes = math.floor((tamrielDaySeconds % 3600) / 60)
local seconds = tamrielDaySeconds % 60
return string.format("%02d:%02d:%02d", hours, minutes, seconds)
end
-- Get local real-world time (system clock)
local function GetLocalTime()
return os.date("%H:%M:%S")
end
-- UI setup
local function CreateClockUI()
MyClock.label = WINDOW_MANAGER:CreateControl("MyClockLabel", GuiRoot, CT_LABEL)
local label = MyClock.label
label:SetFont("ZoFontGameLarge")
label:SetColor(1, 1, 1, 1)
label:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, 20, 20)
label:SetText("Loading time...")
end
-- Update function
local function OnUpdate()
local realTime = GetLocalTime()
local tamrielTime = GetTamrielTime()
MyClock.label:SetText(
string.format("Local Time: %s\nTamriel Time: %s", realTime, tamrielTime)
)
end
-- Event handler
function MyClock.OnAddOnLoaded(event, addonName)
if addonName ~= MyClock.name then return end
CreateClockUI()
EVENT_MANAGER:RegisterForUpdate(
MyClock.name .. "Update",
MyClock.updateInterval * 1000,
OnUpdate
)
end
EVENT_MANAGER:RegisterForEvent(MyClock.name, EVENT_ADD_ON_LOADED, MyClock.OnAddOnLoaded)
SilverBride wrote: »Thanks but all I want is real world time and nothing else.
SilverBride wrote: »Thanks but all I want is real world time and nothing else.

have you seen one of theseSilverBride wrote: »Thanks but all I want is real world time and nothing else.