-- Establish the duration of the timer
local timer_duration = 5

-- A variable to store how much time has passed
local timer_elapsed

-- The function which is called on each update
local function UpdateTimer(self, elapsed)
	timer_elapsed = timer_elapsed + elapsed	-- Increment our timer
	-- If we have waited for the duration, then do something and reset the timer.
	if timer_elapsed >= timer_duration then
		-- Insert code or function call to run
		timer_elapsed = 0	-- Reset timer, or...
		self:SetScript("OnUpdate", nil)	-- Turn timer off

local timer_frame = CreateFrame("Frame")	-- Create a frame for the timer.
timer_frame:SetScript("OnUpdate", UpdateTimer)	-- Start updating