time.h function clock() only returning 0

Ulrich Drepper drepper at redhat.com
Thu Apr 8 02:46:25 UTC 2004


Brian Bober wrote:
> I was testing whether clock skew between gettimeofday and between clock() still
> occurred, and I noticed now that clock() returns 0 only.

clock() does not measure wall time, it measures CPU time of the process.
 You should be thankful that the value is always zero since this means
sleep() is not implemented as a busy loop.  Write some real code which
doesn't spend all the time in the kernel and you'll see nonzero values
returned.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖





More information about the fedora-test-list mailing list