report CPU time used
cc . . . -lc
long clock ()
The clock function
returns the amount of CPU time (in microseconds)
used since the first call to clock.
The time reported is the sum of the user and system times of the
calling process and its terminated child processes for which it has executed
The resolution of the time values returned is 10,000 microseconds
corresponding to the value of HZ within the kernel..
The value returned
wraps around after accumulating
2147 seconds of CPU time (about 36 minutes).
Code that compares old and new clock values
must be written to be accurate across these wraps.
For example, to determine
whether or not MAX_TIME has passed
This subtraction works whether
values are negative or positive.
start_time must be declared
as a signed integer.
if (clock - start_time >= MAX_TIME)
Avoid using constructions such as the following:
if (clock >= (start_time + MAX_TIME)) /* INCORRECT use of clock */
This fails if (start_time + MAX_TIME) is positive
has wrapped and is negative.
clock is conformant with:
X/Open Portability Guide, Issue 3, 1989
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003