View Single Post
12/19/14, 07:29 AM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
It should be simple. Guild history data contains timestamp when event was received and time since event, so it is easy to get real time. You will need just to hook setup function for guild history row and change what is displayed.

Lua Code:
  1. --backup of the original function
  2. local SetupGuildEvent_Orig = GUILD_HISTORY.SetupGuildEvent
  3.  
  4. function GUILD_HISTORY:SetupGuildEvent(control, data, ...)
  5.     --call original function first
  6.     SetupGuildEvent_Orig(self, control, data, ...)
  7.  
  8.     --get timestamp (epoch time) of the event
  9.     local timestamp = GetTimeStamp() - data.secsSinceEvent - (GetFrameTimeSeconds() - data.timeStamp)
  10.     --get date of the event from timestamp
  11.     local datestring = GetDateStringFromTimestamp(timestamp)
  12.     --get time of the event, however this time is valid for GMT time zone
  13.     local timestring = ZO_FormatTime(timestamp % 86400, TIME_FORMAT_STYLE_CLOCK_TIME, TIME_FORMAT_PRECISION_TWENTY_FOUR_HOUR) --timestamp % 86400 = seconds since midnight in GMT time zone (% = modulo, 86400 = number of seconds in a day)
  14.  
  15.     --set new text
  16.     control:GetNamedChild("Time"):SetText(datestring .. " " .. timestring)
  17. end

Now you just have to figure out how to convert GMT time to your timezone. I was thinking about something like:
Lua Code:
  1. local correction = GetSecondsSinceMidnight() - (GetTimeStamp() % 86400)
However it probably won't work if date in timezones is different.
  Reply With Quote