From 0dd10269d15b11b3beb0cb1b8537e15126699d32 Mon Sep 17 00:00:00 2001 From: leak Date: Sun, 8 Jun 2014 20:08:43 +0200 Subject: Replaced dependencies on ace/OS_NS_time.h --- src/server/shared/Utilities/Util.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/server/shared/Utilities/Util.cpp') diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp index ffef61557fc..fc01442adb3 100644 --- a/src/server/shared/Utilities/Util.cpp +++ b/src/server/shared/Utilities/Util.cpp @@ -127,6 +127,18 @@ void stripLineInvisibleChars(std::string &str) } +std::tm localtime_r(const time_t& time) +{ + std::tm tm_snapshot; +#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) + localtime_s(&tm_snapshot, &time); +#else + localtime_r(&time, &tm_snapshot); // POSIX +#endif + return tm_snapshot; +} + + std::string secsToTimeString(uint64 timeInSecs, bool shortText, bool hoursOnly) { uint64 secs = timeInSecs % MINUTE; @@ -215,8 +227,7 @@ uint32 TimeStringToSecs(const std::string& timestring) std::string TimeToTimestampStr(time_t t) { - tm aTm; - ACE_OS::localtime_r(&t, &aTm); + tm aTm = localtime_r(t); // YYYY year // MM month (2 digits 01-12) // DD day (2 digits 01-31) -- cgit v1.2.3