diff --git a/ChangeLog b/ChangeLog index e939b7da69..c039995465 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Sat Jul 28 16:26:09 2012 Hiroshi Shirosaki + + * win32/win32.c (gmtime_r): use _gmtime64_s() with x86_64-w64-mingw32. + + * win32/win32.c (localtime_r): use _localtime64_s() with + x86_64-w64-mingw32. Since FileTimeToSystemTime() seems not work with + large value under x64. Mingw-w64 doesn't have these declaration. + [ruby-core:46780] [Bug #6794] + Fri Jul 27 18:25:51 2012 Nobuyoshi Nakada * io.c (rb_io_check_io): make public. diff --git a/win32/win32.c b/win32/win32.c index f330ee1591..c48979d913 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -6555,7 +6555,7 @@ rb_w32_fd_is_text(int fd) { return _osfile(fd) & FTEXT; } -#if RUBY_MSVCRT_VERSION < 80 +#if RUBY_MSVCRT_VERSION < 80 && !defined(__MINGW64__) /* License: Ruby's */ static int unixtime_to_systemtime(const time_t t, SYSTEMTIME *st) @@ -6617,6 +6617,17 @@ systemtime_to_localtime(TIME_ZONE_INFORMATION *tz, SYSTEMTIME *gst, SYSTEMTIME * } #endif +#ifdef __MINGW64__ +#ifndef gmtime_s +# define gmtime_s _gmtime64_s + errno_t gmtime_s(struct tm* _tm, const time_t *time); +#endif +#ifndef localtime_s +# define localtime_s _localtime64_s + errno_t localtime_s(struct tm* _tm, const time_t *time); +#endif +#endif + /* License: Ruby's */ struct tm * gmtime_r(const time_t *tp, struct tm *rp) @@ -6627,7 +6638,7 @@ gmtime_r(const time_t *tp, struct tm *rp) errno = e; return NULL; } -#if RUBY_MSVCRT_VERSION >= 80 +#if RUBY_MSVCRT_VERSION >= 80 || defined(__MINGW64__) e = gmtime_s(rp, tp); if (e != 0) goto error; #else @@ -6651,7 +6662,7 @@ localtime_r(const time_t *tp, struct tm *rp) errno = e; return NULL; } -#if RUBY_MSVCRT_VERSION >= 80 +#if RUBY_MSVCRT_VERSION >= 80 || defined(__MINGW64__) e = localtime_s(rp, tp); if (e) goto error; #else