mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
76fa4a8216
commit
551ab77c38
2 changed files with 20 additions and 5 deletions
|
@ -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>
|
Sun Mar 4 17:01:09 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
* string.c (trnext): support backslash escape in String#tr.
|
* string.c (trnext): support backslash escape in String#tr.
|
||||||
|
|
|
@ -2495,11 +2495,21 @@ waitpid (pid_t pid, int *stat_loc, int options)
|
||||||
int _cdecl
|
int _cdecl
|
||||||
gettimeofday(struct timeval *tv, struct timezone *tz)
|
gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||||
{
|
{
|
||||||
struct timeb tb;
|
SYSTEMTIME st;
|
||||||
|
time_t t;
|
||||||
|
struct tm tm;
|
||||||
|
|
||||||
ftime(&tb);
|
GetLocalTime(&st);
|
||||||
tv->tv_sec = tb.time;
|
tm.tm_sec = st.wSecond;
|
||||||
tv->tv_usec = tb.millitm * 1000;
|
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;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue