Add localtime_r function which is not existing in Windows

This commit is contained in:
Xele02 2012-12-15 12:59:31 +01:00
parent 825e058c94
commit 6eef9a1d1e

View File

@ -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!