New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perl's times() support is messy, esp on Win32 #14611
Comments
From rosiejjjj@outlook.comCreated by @bulk88I looked at Win32 Perl's implementation of times() today, which is below. DllExport int
win32_times(struct tms *timebuf)
{
FILETIME user;
FILETIME kernel;
FILETIME dummy;
if (GetProcessTimes(GetCurrentProcess(), &dummy, &dummy,
&kernel,&user)) {
timebuf->tms_utime = filetime_to_clock(&user);
timebuf->tms_stime = filetime_to_clock(&kernel);
timebuf->tms_cutime = 0;
timebuf->tms_cstime = 0;
} else {
/* That failed - e.g. Win95 fallback to clock() */
timebuf->tms_utime = process_time_so_far;
timebuf->tms_stime = 0;
timebuf->tms_cutime = 0;
timebuf->tms_cstime = 0;
}
return process_time_so_far;
} Problems, 1. it looks like there is Win95 code which was forgotten to be PP(pp_tms)
{
#ifdef HAS_TIMES
dSP;
struct tms timesbuf;
EXTEND(SP, 4);
(void)PerlProc_times(×buf);
mPUSHn(((NV)timesbuf.tms_utime)/(NV)PL_clocktick);
if (GIMME_V == G_ARRAY) {
mPUSHn(((NV)timesbuf.tms_stime)/(NV)PL_clocktick);
mPUSHn(((NV)timesbuf.tms_cutime)/(NV)PL_clocktick);
mPUSHn(((NV)timesbuf.tms_cstime)/(NV)PL_clocktick);
}
RETURN;
#else
# ifdef PERL_MICRO
dSP;
mPUSHn(0.0);
EXTEND(SP, 4);
if (GIMME_V == G_ARRAY) {
mPUSHn(0.0);
mPUSHn(0.0);
mPUSHn(0.0);
}
RETURN;
# else
DIE(aTHX_ "times not implemented");
# endif
#endif /* HAS_TIMES */
} the retval is unused, and potentially, strictly according to the book, I think MS CRT clock() is too complicated in implementation for the What about making PL_clocktick a constant (if possible on the platform) related links http://code.metager.de/source/xref/gnu/octave/gnulib-hg/lib/times.c Perl Info
|
From @jkeenanIs there any particular aspect of the win32 implementation of times() for which you would like to propose a patch? Thank you very much. -- |
The RT System itself - Status changed from 'new' to 'open' |
Migrated from rt.perl.org#124152 (status was 'open')
Searchable as RT124152$
The text was updated successfully, but these errors were encountered: