aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Time/GameTime.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-11-21 12:25:22 +0100
committerShauren <shauren.trinity@gmail.com>2023-12-02 15:57:03 +0100
commit45a5b6a9f04d2f605e7141b8da6e9cfa24711e07 (patch)
tree5d0f5890d888610ad4cf598db9c47e831a41eb35 /src/server/game/Time/GameTime.cpp
parent9daaa99ed49fc4ed63007bc932a411d33b5b7ef8 (diff)
Core/Calendar: Implement different timezone support for ingame calendar
Closes #8390 Closes #29427 (cherry picked from commit b888b1b09f71a8b8b4a9d45c804a1f164fb65ac3)
Diffstat (limited to 'src/server/game/Time/GameTime.cpp')
-rw-r--r--src/server/game/Time/GameTime.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/server/game/Time/GameTime.cpp b/src/server/game/Time/GameTime.cpp
index 7742cabef20..733f381f796 100644
--- a/src/server/game/Time/GameTime.cpp
+++ b/src/server/game/Time/GameTime.cpp
@@ -17,6 +17,9 @@
#include "GameTime.h"
#include "Timer.h"
+#include "Timezone.h"
+#include "Util.h"
+#include "WowTime.h"
namespace GameTime
{
@@ -28,6 +31,9 @@ namespace GameTime
SystemTimePoint GameTimeSystemPoint = SystemTimePoint ::min();
TimePoint GameTimeSteadyPoint = TimePoint::min();
+ WowTime UtcWow;
+ WowTime Wow;
+
time_t GetStartTime()
{
return StartTime;
@@ -58,11 +64,23 @@ namespace GameTime
return uint32(GameTime - StartTime);
}
+ WowTime const* GetUtcWowTime()
+ {
+ return &UtcWow;
+ }
+
+ WowTime const* GetWowTime()
+ {
+ return &Wow;
+ }
+
void UpdateGameTimers()
{
GameTime = time(nullptr);
GameMSTime = getMSTime();
GameTimeSystemPoint = std::chrono::system_clock::now();
GameTimeSteadyPoint = std::chrono::steady_clock::now();
+ UtcWow.SetUtcTimeFromUnixTime(GameTime);
+ Wow = UtcWow + Trinity::Timezone::GetSystemZoneOffsetAt(GameTimeSystemPoint);
}
}