diff options
| author | leak <leak@bitmx.net> | 2014-06-22 15:42:46 +0200 |
|---|---|---|
| committer | leak <leak@bitmx.net> | 2014-06-22 15:42:46 +0200 |
| commit | 7dd6f0f1d8dcd14c8b9306553170f0023d30fc66 (patch) | |
| tree | 02ff8f931f5a3f972bf5b1cf9c56c89697f82139 /src/server/shared/Utilities | |
| parent | ccf3374e494c31f52c9ae3b63480e3cc6fd2510d (diff) | |
Replaced all ACE_OS::localtime_r calls
Diffstat (limited to 'src/server/shared/Utilities')
| -rw-r--r-- | src/server/shared/Utilities/Util.cpp | 12 | ||||
| -rw-r--r-- | src/server/shared/Utilities/Util.h | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp index c766cc3ca91..f80730af05d 100644 --- a/src/server/shared/Utilities/Util.cpp +++ b/src/server/shared/Utilities/Util.cpp @@ -139,15 +139,14 @@ void stripLineInvisibleChars(std::string &str) } -std::tm localtime_r(const time_t& time) +struct tm* localtime_r(const time_t* time, struct tm *result) { - std::tm tm_snapshot; #if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) - localtime_s(&tm_snapshot, &time); + localtime_s(result, time); + return result; #else - localtime_r(&time, &tm_snapshot); // POSIX + return localtime_r(&time, &result); // POSIX #endif - return tm_snapshot; } @@ -239,7 +238,8 @@ uint32 TimeStringToSecs(const std::string& timestring) std::string TimeToTimestampStr(time_t t) { - tm aTm = localtime_r(t); + tm aTm; + localtime_r(&t, &aTm); // YYYY year // MM month (2 digits 01-12) // DD day (2 digits 01-31) diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h index af28afd66ff..21e5ac2ce0f 100644 --- a/src/server/shared/Utilities/Util.h +++ b/src/server/shared/Utilities/Util.h @@ -70,7 +70,7 @@ void stripLineInvisibleChars(std::string &src); int32 MoneyStringToMoney(const std::string& moneyString); -std::tm localtime_r(const time_t& time); +struct tm* localtime_r(const time_t* time, struct tm *result); std::string secsToTimeString(uint64 timeInSecs, bool shortText = false, bool hoursOnly = false); uint32 TimeStringToSecs(const std::string& timestring); |
