diff options
author | jackpoz <giacomopoz@gmail.com> | 2019-04-19 23:45:07 +0200 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2019-04-19 23:45:07 +0200 |
commit | b33934f6ce9b0227597c712dd6a76b7ed49deea3 (patch) | |
tree | f64ecc410dd4282ddc145f5f0527ef3b841f8a02 /src/server/game/Handlers/CalendarHandler.cpp | |
parent | 3d3b7f438c6638aed998f4233b809826a3cf0f54 (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.
Diffstat (limited to 'src/server/game/Handlers/CalendarHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/CalendarHandler.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index 9fb058dff0d..45afefda920 100644 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -238,6 +238,8 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData) recvData.ReadPackedTime(unkPackedTime); recvData >> flags; + eventPackedTime = uint32(LocalTimeToUTCTime(eventPackedTime)); + // prevent events in the past // To Do: properly handle timezones and remove the "- time_t(86400L)" hack if (time_t(eventPackedTime) < (GameTime::GetGameTime() - time_t(86400L))) @@ -331,6 +333,8 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData) recvData.ReadPackedTime(timeZoneTime); recvData >> flags; + eventPackedTime = uint32(LocalTimeToUTCTime(eventPackedTime)); + // prevent events in the past // To Do: properly handle timezones and remove the "- time_t(86400L)" hack if (time_t(eventPackedTime) < (GameTime::GetGameTime() - time_t(86400L))) @@ -388,6 +392,8 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData) TC_LOG_DEBUG("network", "CMSG_CALENDAR_COPY_EVENT [%s], EventId [" UI64FMTD "] inviteId [" UI64FMTD "] Time: %u", guid.ToString().c_str(), eventId, inviteId, eventTime); + eventTime = uint32(LocalTimeToUTCTime(eventTime)); + // prevent events in the past // To Do: properly handle timezones and remove the "- time_t(86400L)" hack if (time_t(eventTime) < (GameTime::GetGameTime() - time_t(86400L))) |