mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Misc: Remove unsafe not thread-safe localtime() calls
Replace not thread-safe localtime() calls with thread-safe localtime_r().
This commit is contained in:
@@ -2935,7 +2935,8 @@ void World::InitCurrencyResetTime()
|
||||
|
||||
// generate time by config
|
||||
time_t curTime = time(NULL);
|
||||
tm localTm = *localtime(&curTime);
|
||||
tm localTm;
|
||||
localtime_r(&curTime, &localTm);
|
||||
|
||||
localTm.tm_wday = getIntConfig(CONFIG_CURRENCY_RESET_DAY);
|
||||
localTm.tm_hour = getIntConfig(CONFIG_CURRENCY_RESET_HOUR);
|
||||
|
||||
@@ -280,7 +280,8 @@ public:
|
||||
// Format creation date
|
||||
char createdDateStr[20];
|
||||
time_t createdDate = guild->GetCreatedDate();
|
||||
strftime(createdDateStr, 20, "%Y-%m-%d %H:%M:%S", localtime(&createdDate));
|
||||
tm localTm;
|
||||
strftime(createdDateStr, 20, "%Y-%m-%d %H:%M:%S", localtime_r(&createdDate, &localTm));
|
||||
|
||||
handler->PSendSysMessage(LANG_GUILD_INFO_CREATION_DATE, createdDateStr); // Creation Date
|
||||
handler->PSendSysMessage(LANG_GUILD_INFO_MEMBER_COUNT, guild->GetMemberCount()); // Number of Members
|
||||
|
||||
Reference in New Issue
Block a user