diff options
| -rw-r--r-- | src/time64.c | 4 | ||||
| -rw-r--r-- | src/time64.h | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/time64.c b/src/time64.c index cfbe7ac..218088e 100644 --- a/src/time64.c +++ b/src/time64.c @@ -443,7 +443,7 @@ void copy_TM64_to_tm(const struct TM *src, struct tm *dest) { } -#ifndef HAVE_LOCALTIME_R +#if !defined(HAVE_LOCALTIME_R) && !defined(_WIN32) /* Simulate localtime_r() to the best of our ability */ static struct tm * fake_localtime_r(const time_t *time, struct tm *result) { const struct tm *static_result = localtime(time); @@ -462,7 +462,7 @@ static struct tm * fake_localtime_r(const time_t *time, struct tm *result) { #endif -#ifndef HAVE_GMTIME_R +#if !defined(HAVE_GMTIME_R) && !defined(_WIN32) /* Simulate gmtime_r() to the best of our ability */ static struct tm * fake_gmtime_r(const time_t *time, struct tm *result) { const struct tm *static_result = gmtime(time); diff --git a/src/time64.h b/src/time64.h index efdc716..28968c0 100644 --- a/src/time64.h +++ b/src/time64.h @@ -58,11 +58,15 @@ Time64_T timelocal64 (struct TM *); /* Not everyone has gm/localtime_r(), provide a replacement */ #ifdef HAVE_LOCALTIME_R # define LOCALTIME_R(clock, result) localtime_r(clock, result) +#elif defined(_WIN32) +# define LOCALTIME_R(clock, result) (localtime_s(result, clock) ? NULL : result) #else # define LOCALTIME_R(clock, result) fake_localtime_r(clock, result) #endif #ifdef HAVE_GMTIME_R # define GMTIME_R(clock, result) gmtime_r(clock, result) +#elif defined (_WIN32) +# define GMTIME_R(clock, result) (gmtime_s(result, clock) ? NULL : result) #else # define GMTIME_R(clock, result) fake_gmtime_r(clock, result) #endif |
