aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Utilities/Util.cpp
diff options
context:
space:
mode:
authorleak <leak@bitmx.net>2014-06-08 20:08:43 +0200
committerleak <leak@bitmx.net>2014-06-08 20:08:43 +0200
commit0dd10269d15b11b3beb0cb1b8537e15126699d32 (patch)
treeef2869752124e71ce868cd1def44079abed0e534 /src/server/shared/Utilities/Util.cpp
parentfdd5e11a15a4e635bb1298c3d4c4b3c9e718e6b0 (diff)
Replaced dependencies on ace/OS_NS_time.h
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)