Quantcast
neverg's Avatar
Files 2
Downloads 50,732
Favorites 248
My AddOns
View Feature Request
Server time display
Feature #: 4289
File: LumUI
Date: 11-12-10 03:22 PM
By: Xaiggl
Status: Under Review
Hi,

First, thanks for a great ui compilation!

The lumstats module only shows local time. I prefer server time so made a small patch which will display server time based on a configuration variable. Just thought I'd share it if you want to include it in a future release. It may not be the best way to do this however it is functional and existing preserves formatting.

Code:
--- lumStats/lumStats.lua	2010-11-08 08:56:18.000000000 +0000
+++ lumStats.lua	2010-11-12 21:16:10.238813557 +0000
@@ -37,6 +37,7 @@
 	local tmargin = 4 -- Text Left and Right Margins

 	

 	local time24 = true -- If true show Time in 24H Format

+	local timeServer = false -- If true show server time instead of local time

 	local nraddons = 20 -- Number of addons to show on the memory tooltip

 

 -- ------------------------------------------------------------------------

@@ -228,15 +229,34 @@
 			

 			-- Time

 			if show_clock then

-				if time24 then

-					hour = date("%H:%M") -- Time 24H Format

+				if timeServer then

+					h,m = GetGameTime()

+					if time24 then

+						hour = format("%02d:%02d", h, m)

+					else

+						timePostfix = "AM"

+						if h >= 12 then

+							h = h - 12

+							timePostfix = "PM"

+						end

+

+						-- adjust for midnight or 12pm

+						if h == 0 then

+						   h = 12

+						end

+						hour = format("%02d:%02d |cff919191%s", h, m, timePostfix)

+					end

 				else

-					hour = date("%I:%M |cff919191%p|r") -- Time 12H Format

+					if time24 then

+						hour = date("%H:%M") -- Time 24H Format

+					else

+						hour = date("%I:%M |cff919191%p|r") -- Time 12H Format

+					end

 				end

 			else

 				hour = ''

-			end				

-			

+			end

+

 			-- Mail

 			if show_mail then

 				if gotMail then
Regards,
Xaiggl

RSS 2.0 Feed for Favorite CommentsNotes Sort Options
By: Xaiggl - 11-12-10 03:24 PM
Ah bollocks, looks the formatting of the patch was messed up on copy and past. Sorry about that.