From 50a1d302912f8e95514027e8e9bdcf4e1b15ae1d Mon Sep 17 00:00:00 2001 From: Yukihiro Matsumoto Date: Sun, 13 May 2012 19:46:57 +0900 Subject: emulate gmtime_r/localtime_r by gmtime_s/localtime_s on Windows --- src/time.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/time.c b/src/time.c index f236b2a77..cf2fd3b91 100644 --- a/src/time.c +++ b/src/time.c @@ -26,8 +26,9 @@ /* #define NO_GMTIME_R */ #ifdef _WIN32 -/* unfortunately Win32 platform do not provide gmtime_r/localtime_r */ -#define NO_GMTIME_R +/* Win32 platform do not provide gmtime_r/localtime_r; emulate them using gmtime_s/localtime_s */ +#define gmtime_r(tp, tm) ((gmtime_s((tm), (tp)) == 0) ? (tp) : NULL) +#define localtime_r(tp, tm) ((localtime_s((tm), (tp)) == 0) ? (tp) : NULL) #endif /* timegm(3) */ -- cgit v1.2.3