From: Dave Thomas Date: 2000-09-04T23:34:12+09:00 Subject: [ruby-talk:4782] Re: Bug in Time.times on NT? Robert Feldt writes: > Hi, > > There seems to be a bug in the script below when I run it on my machine. > (If this has been fixed in 1.6 then please discard this mail). It seems to have been: the code's been restructured, and the Win32 time conversion stuff moved to win32.c: static long filetime_to_clock(FILETIME *ft) { __int64 qw = ft->dwHighDateTime; qw <<= 32; qw |= ft->dwLowDateTime; qw /= 10000; /* File time ticks at 0.1uS, clock at 1mS */ return (long) qw; } int mytimes(struct tms *tmbuf) { FILETIME create, exit, kernel, user; if (GetProcessTimes(GetCurrentProcess(),&create, &exit, &kernel, &user)) { tmbuf->tms_utime = filetime_to_clock(&user); tmbuf->tms_stime = filetime_to_clock(&kernel); tmbuf->tms_cutime = 0; tmbuf->tms_cstime = 0; } else { tmbuf->tms_utime = clock(); tmbuf->tms_stime = 0; tmbuf->tms_cutime = 0; tmbuf->tms_cstime = 0; } return 0; }