diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-05-13 19:46:57 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-05-13 19:46:57 +0900 |
| commit | 50a1d302912f8e95514027e8e9bdcf4e1b15ae1d (patch) | |
| tree | d85fe304588dbb9f35e317f81cee166e17e937e3 /src/time.c | |
| parent | 69c1b9b797f5a1081e30af2c00d1350d68e4bced (diff) | |
| download | mruby-50a1d302912f8e95514027e8e9bdcf4e1b15ae1d.tar.gz mruby-50a1d302912f8e95514027e8e9bdcf4e1b15ae1d.zip | |
emulate gmtime_r/localtime_r by gmtime_s/localtime_s on Windows
Diffstat (limited to 'src/time.c')
| -rw-r--r-- | src/time.c | 5 |
1 files changed, 3 insertions, 2 deletions
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) */ |
