diff options
author | Allen Winter <allen.winter@kdab.com> | 2015-06-15 17:04:26 -0400 |
---|---|---|
committer | Allen Winter <allen.winter@kdab.com> | 2015-06-15 17:09:20 -0400 |
commit | a123adcabbbb583c0e5829d40f6bd8ad345207bc (patch) | |
tree | bd6aff418570551348a4de8ff373a8d44047d6ab /config.h.cmake | |
parent | b6e8243c2518367642075139b48d9854915576ba (diff) | |
download | libical-git-a123adcabbbb583c0e5829d40f6bd8ad345207bc.tar.gz |
cmake discovery for localtime_r()
Diffstat (limited to 'config.h.cmake')
-rwxr-xr-x | config.h.cmake | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/config.h.cmake b/config.h.cmake index 0d567369..80d32455 100755 --- a/config.h.cmake +++ b/config.h.cmake @@ -18,6 +18,9 @@ /* Define to 1 if you have the `gmtime_r' function. */ #cmakedefine HAVE_GMTIME_R 1 +/* Define to 1 if you have the `localtime_r' function. */ +#cmakedefine HAVE_LOCALTIME_R 1 + /* Define to 1 if you have the <inttypes.h> header file. */ #cmakedefine HAVE_INTTYPES_H 1 @@ -472,7 +475,7 @@ typedef ssize_t IO_SSIZE_T; #endif #endif -/* gmtime_r - thread safe gmtime() really only need on Unix */ +/* gmtime_r - thread safe gmtime() really only needed on Unix */ #if !defined(HAVE_GMTIME_R) #if !defined(_WIN32) #error "No thread-safe gmtime function available" @@ -486,6 +489,20 @@ typedef ssize_t IO_SSIZE_T; #endif #include <time.h> +/* localtime_r - thread safe localtime() really only needed on Unix */ +#if !defined(HAVE_LOCALTIME_R) +#if !defined(_WIN32) +#error "No thread-safe localtime function available" +#endif +/*on Windows there might be a macro called localtime_r in pthread.h. don't use it.*/ +#if defined(localtime_r) +#undef localtime_r +#endif +/* FYI: The localtime() in Microsoft's C library is MT-safe */ +#define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0) +#endif +#include <time.h> + /* define MAXPATHLEN */ #if defined(_WIN32) #include <windows.h> //for MAX_PATH |