diff options
author | jackpoz <giacomopoz@gmail.com> | 2019-04-19 23:45:07 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-12-01 00:46:05 +0100 |
commit | 5600316c9f69d2afda82ae0e632715b420dfd402 (patch) | |
tree | 69916db003c4e4b622977f76695f6bf2ecfb41c4 /src/server/game/Handlers/CalendarHandler.cpp | |
parent | aeaca00d76d0fdaee6d21050a1fadcf1f0543358 (diff) |
Core/Calendar: Improve calendar timezone handling
Improve calendar timezone handling by at least creating events with the correct time if both client and server are in the same timezone. There is currently no information received from the client about in which timezone it is.
(cherry picked from commit b33934f6ce9b0227597c712dd6a76b7ed49deea3)
Diffstat (limited to 'src/server/game/Handlers/CalendarHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/CalendarHandler.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index 54a67a67e91..37118477dca 100644 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -50,6 +50,7 @@ Copied events should probably have a new owner #include "Opcodes.h" #include "Player.h" #include "SocialMgr.h" +#include "Util.h" #include "World.h" void WorldSession::HandleCalendarGetCalendar(WorldPackets::Calendar::CalendarGetCalendar& /*calendarGetCalendar*/) @@ -135,6 +136,8 @@ void WorldSession::HandleCalendarAddEvent(WorldPackets::Calendar::CalendarAddEve { ObjectGuid guid = _player->GetGUID(); + calendarAddEvent.EventInfo.Time = uint32(LocalTimeToUTCTime(calendarAddEvent.EventInfo.Time)); + // prevent events in the past // To Do: properly handle timezones and remove the "- time_t(86400L)" hack if (calendarAddEvent.EventInfo.Time < (GameTime::GetGameTime() - time_t(86400L))) @@ -180,6 +183,8 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPackets::Calendar::CalendarUpd ObjectGuid guid = _player->GetGUID(); time_t oldEventTime = time_t(0); + calendarUpdateEvent.EventInfo.Time = uint32(LocalTimeToUTCTime(calendarUpdateEvent.EventInfo.Time)); + // prevent events in the past // To Do: properly handle timezones and remove the "- time_t(86400L)" hack if (calendarUpdateEvent.EventInfo.Time < (GameTime::GetGameTime() - time_t(86400L))) @@ -213,6 +218,8 @@ void WorldSession::HandleCalendarCopyEvent(WorldPackets::Calendar::CalendarCopyE { ObjectGuid guid = _player->GetGUID(); + calendarCopyEvent.Date = uint32(LocalTimeToUTCTime(calendarCopyEvent.Date)); + // prevent events in the past // To Do: properly handle timezones and remove the "- time_t(86400L)" hack if (calendarCopyEvent.Date < (GameTime::GetGameTime() - time_t(86400L))) |