diff options
| author | Vincent-Michael <Vincent_Michael@gmx.de> | 2013-09-11 22:35:45 +0200 |
|---|---|---|
| committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2013-09-11 22:35:45 +0200 |
| commit | 974bf5c427a5b134f09abf48d814f8c8f7e31e3c (patch) | |
| tree | e136c5b86e90ac3d15c679e96c8894428e3476aa /src/server/shared | |
| parent | 5583bcfeeac63477deede2ea744f79ea2710401c (diff) | |
| parent | 38f5c916cf1b4f29b7e0c026af68aac482e9f526 (diff) | |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts:
src/server/game/Accounts/RBAC.h
src/server/game/Battlegrounds/ArenaTeam.cpp
Diffstat (limited to 'src/server/shared')
| -rw-r--r-- | src/server/shared/Common.h | 1 | ||||
| -rw-r--r-- | src/server/shared/Logging/Appender.cpp | 5 | ||||
| -rw-r--r-- | src/server/shared/Logging/Log.cpp | 5 | ||||
| -rw-r--r-- | src/server/shared/Packets/ByteBuffer.h | 6 | ||||
| -rw-r--r-- | src/server/shared/Utilities/Timer.h | 2 | ||||
| -rw-r--r-- | src/server/shared/Utilities/Util.cpp | 5 |
6 files changed, 15 insertions, 9 deletions
diff --git a/src/server/shared/Common.h b/src/server/shared/Common.h index 779eb95e291..6a15d12e02a 100644 --- a/src/server/shared/Common.h +++ b/src/server/shared/Common.h @@ -92,6 +92,7 @@ #include <ace/Guard_T.h> #include <ace/RW_Thread_Mutex.h> #include <ace/Thread_Mutex.h> +#include <ace/OS_NS_time.h> #if PLATFORM == PLATFORM_WINDOWS # include <ace/config-all.h> diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index cde94fe3a7c..f47cbc3b095 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -20,9 +20,10 @@ std::string LogMessage::getTimeStr(time_t time) { - tm* aTm = localtime(&time); + tm aTm; + ACE_OS::localtime_r(&time, &aTm); char buf[20]; - snprintf(buf, 20, "%04d-%02d-%02d_%02d:%02d:%02d", aTm->tm_year+1900, aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec); + snprintf(buf, 20, "%04d-%02d-%02d_%02d:%02d:%02d", aTm.tm_year+1900, aTm.tm_mon+1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec); return std::string(buf); } diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index be7aab9cf5e..e6400176155 100644 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -295,7 +295,8 @@ void Log::write(LogMessage* msg) std::string Log::GetTimestampStr() { time_t t = time(NULL); - tm* aTm = localtime(&t); + tm aTm; + ACE_OS::localtime_r(&t, &aTm); // YYYY year // MM month (2 digits 01-12) // DD day (2 digits 01-31) @@ -303,7 +304,7 @@ std::string Log::GetTimestampStr() // MM minutes (2 digits 00-59) // SS seconds (2 digits 00-59) char buf[20]; - snprintf(buf, 20, "%04d-%02d-%02d_%02d-%02d-%02d", aTm->tm_year+1900, aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec); + snprintf(buf, 20, "%04d-%02d-%02d_%02d-%02d-%02d", aTm.tm_year+1900, aTm.tm_mon+1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec); return std::string(buf); } diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 51b1a615bf1..c30dfff2f40 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -23,6 +23,7 @@ #include "Errors.h" #include "ByteConverter.h" +#include <ace/OS_NS_time.h> #include <exception> #include <list> #include <map> @@ -585,8 +586,9 @@ class ByteBuffer void AppendPackedTime(time_t time) { - tm* lt = localtime(&time); - append<uint32>((lt->tm_year - 100) << 24 | lt->tm_mon << 20 | (lt->tm_mday - 1) << 14 | lt->tm_wday << 11 | lt->tm_hour << 6 | lt->tm_min); + tm lt; + ACE_OS::localtime_r(&time, <); + append<uint32>((lt.tm_year - 100) << 24 | lt.tm_mon << 20 | (lt.tm_mday - 1) << 14 | lt.tm_wday << 11 | lt.tm_hour << 6 | lt.tm_min); } void put(size_t pos, const uint8 *src, size_t cnt) diff --git a/src/server/shared/Utilities/Timer.h b/src/server/shared/Utilities/Timer.h index 5bc19a2b779..b0b395865b4 100644 --- a/src/server/shared/Utilities/Timer.h +++ b/src/server/shared/Utilities/Timer.h @@ -66,7 +66,7 @@ struct IntervalTimer void Reset() { if (_current >= _interval) - _current -= _interval; + _current %= _interval; } void SetCurrent(time_t current) diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp index 32ff396e1c1..e53f0c9b839 100644 --- a/src/server/shared/Utilities/Util.cpp +++ b/src/server/shared/Utilities/Util.cpp @@ -215,7 +215,8 @@ uint32 TimeStringToSecs(const std::string& timestring) std::string TimeToTimestampStr(time_t t) { - tm* aTm = localtime(&t); + tm aTm; + ACE_OS::localtime_r(&t, &aTm); // YYYY year // MM month (2 digits 01-12) // DD day (2 digits 01-31) @@ -223,7 +224,7 @@ std::string TimeToTimestampStr(time_t t) // MM minutes (2 digits 00-59) // SS seconds (2 digits 00-59) char buf[20]; - snprintf(buf, 20, "%04d-%02d-%02d_%02d-%02d-%02d", aTm->tm_year+1900, aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec); + snprintf(buf, 20, "%04d-%02d-%02d_%02d-%02d-%02d", aTm.tm_year+1900, aTm.tm_mon+1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec); return std::string(buf); } |
