SavedInstances

SavedInstances

11M Downloads

Reset Time Wrong on EU Realm

behhNa opened this issue ยท 2 comments

commented

Hi,
suddenly the reset time is wrong. Today (Wed, 03. April 2019) was reset day here in EU. The addon tells me that the reset is tomorrow on Thu.

FYI: We changed to DST last Sunday. Maybe that aligns somehow.

commented

I have this issue on CN Realm either, which was first found in #211 and fixed in 0529d01. But I don't know why it is happening again. Maybe we should allow a day and check if it is still there.

commented

function addon:GetServerOffset()
local serverDate = C_DateAndTime.GetCurrentCalendarTime() -- 1-based starts on Sun
local serverDay, serverWeekday, serverMonth, serverMinute, serverHour, serverYear = serverDate.monthDay, serverDate.weekday, serverDate.month, serverDate.minute, serverDate.hour, serverDate.year
-- #211: date("%w") is 0-based starts on Sun
local localDay = tonumber(date("%w")) + 1
local localHour, localMinute = tonumber(date("%H")), tonumber(date("%M"))
if serverDay == (localDay + 1)%7 then -- server is a day ahead
serverHour = serverHour + 24
elseif localDay == (serverDay + 1)%7 then -- local is a day ahead
localHour = localHour + 24
end
local server = serverHour + serverMinute / 60
local localT = localHour + localMinute / 60
local offset = floor((server - localT) * 2 + 0.5) / 2
return offset
end

Still the problem of GetServerOffset, it compares monthDay to weekday which causes the issue.