aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Utilities/Util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/shared/Utilities/Util.cpp')
-rw-r--r--src/server/shared/Utilities/Util.cpp15
1 files changed, 13 insertions, 2 deletions
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)