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

+14 -6
View File
@@ -25,6 +25,7 @@
#include "Chat.h"
#include "Config.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "GuildFinderMgr.h"
#include "GuildMgr.h"
#include "Language.h"
@@ -179,6 +180,8 @@ inline void Guild::LogHolder::WritePacket(WorldPacket& data) const
data.append(buffer);
}
Guild::LogEntry::LogEntry(ObjectGuid::LowType guildId, uint32 guid) : m_guildId(guildId), m_guid(guid), m_timestamp(GameTime::GetGameTime()) { }
inline uint32 Guild::LogHolder::GetNextGUID()
{
// Next guid was not initialized. It means there are no records for this holder in DB yet.
@@ -244,7 +247,7 @@ void Guild::EventLogEntry::WritePacket(WorldPacket& data, ByteBuffer& content) c
content.WriteByteSeq(guid1[4]);
// Event timestamp
content << uint32(::time(nullptr) - m_timestamp);
content << uint32(::GameTime::GetGameTime() - m_timestamp);
content.WriteByteSeq(guid1[7]);
content.WriteByteSeq(guid1[3]);
@@ -326,7 +329,7 @@ void Guild::BankEventLogEntry::WritePacket(WorldPacket& data, ByteBuffer& conten
if (hasItem)
content << uint32(m_itemOrMoney);
content << uint32(time(nullptr) - m_timestamp);
content << uint32(GameTime::GetGameTime() - m_timestamp);
if (IsMoneyEvent())
content << uint64(m_itemOrMoney);
@@ -664,7 +667,7 @@ Guild::Member::Member(ObjectGuid::LowType guildId, ObjectGuid guid, uint8 rankId
m_level(0),
m_class(0),
m_flags(GUILDMEMBER_STATUS_NONE),
m_logoutTime(::time(nullptr)),
m_logoutTime(::GameTime::GetGameTime()),
m_accountId(0),
m_rankId(rankId),
m_achievementPoints(0),
@@ -750,6 +753,11 @@ void Guild::Member::AddActivity(uint64 activity)
CharacterDatabase.Execute(stmt);
}
void Guild::Member::UpdateLogoutTime()
{
m_logoutTime = GameTime::GetGameTime();
}
void Guild::Member::SaveToDB(SQLTransaction& trans) const
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_MEMBER);
@@ -1332,7 +1340,7 @@ bool Guild::Create(Player* pLeader, std::string const& name)
m_info = "";
m_motd = "No message set.";
m_bankMoney = 0;
m_createdDate = ::time(nullptr);
m_createdDate = ::GameTime::GetGameTime();
_level = 1;
_experience = 0;
_todayExperience = 0;
@@ -1577,7 +1585,7 @@ void Guild::HandleRoster(WorldSession* session)
memberData.WriteByteSeq(guid[4]);
memberData << uint8(0); // unk
memberData.WriteByteSeq(guid[1]);
memberData << float(member->IsOnline() ? 0.0f : float(::time(nullptr) - member->GetLogoutTime()) / DAY);
memberData << float(member->IsOnline() ? 0.0f : float(::GameTime::GetGameTime() - member->GetLogoutTime()) / DAY);
if (offNoteLength)
memberData.WriteString(member->GetOfficerNote());
@@ -3071,7 +3079,7 @@ void Guild::DeleteMember(SQLTransaction& trans, ObjectGuid guid, bool isDisbandi
stmt->setUInt32(0, lowguid);
stmt->setUInt32(1, m_id);
stmt->setUInt32(2, member->GetWeekReputation());
stmt->setUInt64(3, uint32(::time(nullptr)));
stmt->setUInt64(3, uint32(::GameTime::GetGameTime()));
CharacterDatabase.Execute(stmt);
}
delete member;