summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-05 08:29:01 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-05 08:29:01 +0000
commit551ab77c38d451dedb09a92a72d300004d215d90 (patch)
treeece317a7f511c4c18444c8d6f3d20c73bf0838bf
parent76fa4a821633984d4b9df2a80803a02d82983e05 (diff)
* win32/win32.c (gettimeofday): use GetLocalTime() instead of ftime()
for high-resolution timing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--win32/win32.c22
2 files changed, 21 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index b05c7c3e24..71cf2f23b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Mar 5 17:19:56 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * win32/win32.c (gettimeofday): use GetLocalTime() instead of ftime()
+ for high-resolution timing.
+
Sun Mar 4 17:01:09 2001 WATANABE Hirofumi <eban@ruby-lang.org>
* string.c (trnext): support backslash escape in String#tr.
diff --git a/win32/win32.c b/win32/win32.c
index 0dfe3e513c..e170f1b226 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2495,13 +2495,23 @@ waitpid (pid_t pid, int *stat_loc, int options)
int _cdecl
gettimeofday(struct timeval *tv, struct timezone *tz)
{
- struct timeb tb;
+ SYSTEMTIME st;
+ time_t t;
+ struct tm tm;
+
+ GetLocalTime(&st);
+ tm.tm_sec = st.wSecond;
+ tm.tm_min = st.wMinute;
+ tm.tm_hour = st.wHour;
+ tm.tm_mday = st.wDay;
+ tm.tm_mon = st.wMonth - 1;
+ tm.tm_year = st.wYear - 1900;
+ tm.tm_isdst = -1;
+ t = mktime(&tm);
+ tv->tv_sec = t;
+ tv->tv_usec = st.wMilliseconds * 1000;
- ftime(&tb);
- tv->tv_sec = tb.time;
- tv->tv_usec = tb.millitm * 1000;
-
- return 0;
+ return 0;
}
char *