X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/173a5ddc77ceb29b7a0dba6d9feeea95ebbbd72b..661698e54f2bc599dc1a961ffbae08ccdd6b9b97:/include/wx/time.h diff --git a/include/wx/time.h b/include/wx/time.h index d6ff8ba04e..8b79d3ec57 100644 --- a/include/wx/time.h +++ b/include/wx/time.h @@ -53,4 +53,25 @@ wxLongLong WXDLLIMPEXP_BASE wxGetUTCTimeUSec(); #endif #endif // HAVE_GETTIMEOFDAY +/* Two wrapper functions for thread safety */ +#ifdef HAVE_LOCALTIME_R +#define wxLocaltime_r localtime_r +#else +WXDLLIMPEXP_BASE struct tm *wxLocaltime_r(const time_t*, struct tm*); +#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) + // On Windows, localtime _is_ threadsafe! +#warning using pseudo thread-safe wrapper for localtime to emulate localtime_r +#endif +#endif + +#ifdef HAVE_GMTIME_R +#define wxGmtime_r gmtime_r +#else +WXDLLIMPEXP_BASE struct tm *wxGmtime_r(const time_t*, struct tm*); +#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) + // On Windows, gmtime _is_ threadsafe! +#warning using pseudo thread-safe wrapper for gmtime to emulate gmtime_r +#endif +#endif + #endif // _WX_TIME_H_