www.delorie.com/djgpp/doc/libc/libc_822.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

times

Syntax

 
#include <sys/times.h>

clock_t times(struct tms *buf);

Description

This function returns the number of clock ticks used by the current process and all of its children until the moment of call. The number of tics per second is CLOCKS_PER_SEC, defined on time.h.

This is the structure in which times returns its info:

 
struct  tms {
  clock_t tms_cstime;
  clock_t tms_cutime;
  clock_t tms_stime;
  clock_t tms_utime;
};

Currently, the elapsed time of the running program is returned in the tms_utime field, and all other fields return as zero.

Return Value

The number of elapsed tics since the program started.

Portability

ANSI/ISO C No
POSIX 1003.2-1992; 1003.1-2001

Example

 
printf("We used %d seconds of elapsed time\n",
       times(&buf)/CLOCKS_PER_SEC);


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004