summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-13 03:18:00 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-13 03:18:00 +0000
commite9885185c4061dc30987e5897d8cece54c33600f (patch)
tree3f95b47db437a4a1bc8fe4a3198e788cf05f005c /win32
parent54af8757b337a7347a230d450cfda9e2b0c94560 (diff)
* rb_w32_fstat{,i64}: speed up. adjuting timestamps in this function
is to get rid of the side effect of ENV["TZ"]. then, if ENV["TZ"] is not set, no need to adjust. this change makes File#stat about 60% faster. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 29f95c9..325954e 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4815,6 +4815,8 @@ rb_w32_fstat(int fd, struct stat *st)
if (ret) return ret;
#ifdef __BORLANDC__
st->st_mode &= ~(S_IWGRP | S_IWOTH);
+#else
+ if (GetEnvironmentVariableW(L"TZ", NULL, 0) == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND) return ret;
#endif
if (GetFileInformationByHandle((HANDLE)_get_osfhandle(fd), &info)) {
#ifdef __BORLANDC__
@@ -4835,7 +4837,12 @@ rb_w32_fstati64(int fd, struct stati64 *st)
{
BY_HANDLE_FILE_INFORMATION info;
struct stat tmp;
- int ret = fstat(fd, &tmp);
+ int ret;
+
+#ifndef __BORLANDC__
+ if (GetEnvironmentVariableW(L"TZ", NULL, 0) == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND) return _fstati64(fd, st);
+#endif
+ ret = fstat(fd, &tmp);
if (ret) return ret;
#ifdef __BORLANDC__