On Thu, Sep 19, 2002 at 05:48:37PM -0500, James Edward Gray II wrote:
> I've got some general questions about times(). Programming Perl lists
> this function as a problem for portable code, anybody know more
> specific details about what platforms it does or doesn't work on. I'm
> guess it's a Windows and possibly Mac OS (pre OS X) problem, but
> that's just a hunch.
perldoc perlport is the documentation to check when you have any porting
questions about a specific function. perldoc perlport's entry on times:
times Only the first entry returned is nonzero. (Mac OS)
"cumulative" times will be bogus. On anything
other than Windows NT or Windows 2000, "system"
time will be bogus, and "user" time is actually
the time returned by the clock() function in the C
runtime library. (Win32)
Not useful. (RISC OS)
> Also, can anyone better explain the times it returns to me or point me
> to a helpful manpage (I've tried times and getrusage - which was close,
> but not detailed enough). What's the difference between user and
> system time? Does one include the other? Would you add them to get
> total time used by the process?
man times on a Unix system will describe the return values in more detail.
This should be what the values mean regardless of OS, except for the caveats
listed in the perlport entry.
> Finally, basically what I'm needing to do is time some operations by
> grabbing a start time and the an end time. In a couple of places, I
> only need second accuracy, so time() could even work. In other places
> I need fractional seconds though, so times() looks like the better
> answer. Am I making the right assumptions here or am I missing some
> call that would be even better?
If you just want better resolution on time, use Time::HiRes, found on CPAN.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]