| 
 |  | 
#include <sys/types.h> #include <sys/times.h>clock_t times (buffer) struct tms *buffer;
   struct  tms {
           clock_t  tms_utime;
           clock_t  tms_stime;
           clock_t  tms_cutime;
           clock_t  tms_cstime;
   };
This information comes from the calling process and each of its terminated child processes for which it has executed a wait. All times are reported in clock ticks. The number of clock ticks per second is a system-dependent parameter, which is returned by sysconf(_SC_CLK_TCK).
tms_utime is the CPU
time used while executing instructions in the user space of the
calling process.
tms_stime is the CPU
time used by the system on behalf of the calling process.
tms_cutime is the sum of the tms_utimes
and tms_cutimes of the child processes.
tms_cstime is the sum of the tms_stimes
and tms_cstimes of the child processes.
       clock_t l;
       unsigned long ul;
       struct tms buffer;
   
       errno = 0;
       l = times(&buffer);
       if ( l == -1 && errno != 0 )
           /* ... Its an error   ... */
       else        /* otherwise valid value but may be -ve due lbolt overflow */
           ul = (unsigned long) l;
       /* continue using ul */       
X/Open Portability Guide, Issue 3, 1989
;
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1)
;
and
NIST FIPS 151-1
.