View Single Post
01-18-12, 05:56 PM   #7
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Thanks for the insight everyone, worth a read

I figured that a time lookup would be too light to put in a condition and give its own counter. I just update that every second. I did give latency its own update frequency though.

Code:
local _, _, home, world = GetNetStats()

local last = 0
local lastLag = 0

f:SetScript("OnUpdate", function(self, elapsed)
	last = last + elapsed
	lastLag = lastLag + elapsed

	if lastLag >= 10 then
		_, _, home, world = GetNetStats()
		lastLag = 0
	end

	if last >= 1 then
		text:SetText("|cffffffff"..ceil(GetFramerate()).."|r fps   |cffffffff"..home.."|r/|cffffffff"..world.."|r ms   |cffffffff"..date("%H:%M"))
		last = 0
	end
end)
  Reply With Quote