X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/173a5ddc77ceb29b7a0dba6d9feeea95ebbbd72b..66c2bf7b1d9326fb650acfaae22ec50528cfbf7c:/include/wx/time.h diff --git a/include/wx/time.h b/include/wx/time.h index d6ff8ba04e..644422392f 100644 --- a/include/wx/time.h +++ b/include/wx/time.h @@ -3,7 +3,6 @@ // Purpose: Miscellaneous time-related functions. // Author: Vadim Zeitlin // Created: 2011-11-26 -// RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $ // Copyright: (c) 2011 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -53,4 +52,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_