Core/Misc: Replace time(NULL) with GameTime::GetGameTime()

(ported commit: 12701cb0c6c45eb105ad449eb9a56e76d84d691e)
This commit is contained in:
Ovahlord committed 2019-07-08 12:19:19 +02:00
1 parent ba38f74816
commit 5fe3a1f7f9
68 files changed
+335 -259

No files matched your search

@@ -21,6 +21,7 @@
#include "Config.h"
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "GameTime.h"
#include "GridNotifiers.h"
#include "GridStates.h"
#include "Group.h"
@@ -105,7 +106,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance
resetTime = GetResetTimeFor(mapId, difficulty);
else
{
resetTime = time(nullptr) + 2 * HOUR;
resetTime = GameTime::GetGameTime() + 2 * HOUR;
// normally this will be removed soon after in InstanceMap::Add, prevent error
ScheduleReset(true, resetTime, InstResetEvent(0, mapId, difficulty, instanceId));
}
@@ -300,7 +301,7 @@ void InstanceSaveManager::LoadInstances()
void InstanceSaveManager::LoadResetTimes()
{
time_t now = time(nullptr);
time_t now = GameTime::GetGameTime();
time_t today = (now / DAY) * DAY;
// NOTE: Use DirectPExecute for tables that will be queried later
@@ -511,12 +512,12 @@ void InstanceSaveManager::ForceGlobalReset(uint32 mapId, Difficulty difficulty)
ScheduleReset(false, 0, InstResetEvent(1, mapId, difficulty, 0));
ScheduleReset(false, 0, InstResetEvent(4, mapId, difficulty, 0));
// force global reset on the instance
_ResetOrWarnAll(mapId, difficulty, false, time(nullptr));
_ResetOrWarnAll(mapId, difficulty, false, GameTime::GetGameTime());
}
void InstanceSaveManager::Update()
{
time_t now = time(nullptr);
time_t now = GameTime::GetGameTime();
time_t t;
while (!m_resetTimeQueue.empty())
@@ -633,7 +634,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
return;
TC_LOG_DEBUG("misc", "InstanceSaveManager::ResetOrWarnAll: Processing map %s (%u) on difficulty %u (warn? %u)", mapEntry->Name, mapid, uint8(difficulty), warn);
time_t now = time(nullptr);
time_t now = GameTime::GetGameTime();
if (!warn)
{