Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > C

clock(3C)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

clock() — report CPU time used

SYNOPSIS

#include <time.h>

clock_t clock(void);

DESCRIPTION

clock() 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 wait(), system(), or pclose() (see wait(2), system(3S), and popen(3S)). To determine the time in seconds, the value returned by clock() should be divided by the value of the macro CLOCKS_PER_SEC.

The resolution of the clock varies, depending on the hardware and on software configuration.

If the processor time used is not available or its value cannot be represented, the function returns the value (clock_t)-1.

WARNINGS

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 4295 seconds of CPU time (about 72 minutes).

DEPENDENCIES

The default clock resolution is 10 milliseconds.

STANDARDS CONFORMANCE

clock(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, ANSI C

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.