clock(S) 6 January 1993 clock(S) Name clock - report CPU time used Syntax cc . . . -lc long clock () Description 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 pro- cesses for which it has executed wait(S), pclose(S), or system(S). The resolution of the clock is 10 milliseconds. Notes The value returned by clock is defined in microseconds for compatibility with systems that have CPU clocks with much higher resolution. Because of this, the value returned wraps around after accumulating only 2147 seconds of CPU time (about 36 minutes). The frequency of the system clock in ticks per second can be set via the environment variable HZ. clock uses gethz(S), which in turn uses HZ, in calculating the return value. If this fails, the default value, set in <sys/param.h>, is used instead and a warning message is printed to stderr. See also popen(S), system(S), times(S), wait(S) Standards conformance clock is conformant with: AT&T SVID Issue 2; and X/Open Portability Guide, Issue 3, 1989.