From 6eef9a1d1edafb64da52d10d8f5d827567644410 Mon Sep 17 00:00:00 2001 From: Xele02 Date: Sat, 15 Dec 2012 12:59:31 +0100 Subject: [PATCH] Add localtime_r function which is not existing in Windows --- Common/FileUtil.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Common/FileUtil.cpp b/Common/FileUtil.cpp index 885efe8615..8027e56261 100644 --- a/Common/FileUtil.cpp +++ b/Common/FileUtil.cpp @@ -70,6 +70,16 @@ static inline int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **res } #endif +// No thread safe +#ifdef _WIN32 +inline struct tm* localtime_r (const time_t *clock, struct tm *result) { + if (!clock || !result) return NULL; + memcpy(result,localtime(clock),sizeof(*result)); + return result; +} +#endif + + // This namespace has various generic functions related to files and paths. // The code still needs a ton of cleanup. // REMEMBER: strdup considered harmful!