home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / posix / sys / times / times.txh < prev   
Encoding:
Text File  |  1995-07-10  |  908 b   |  40 lines

  1. @node times, time
  2. @subheading Syntax
  3.  
  4. @example
  5. #include <sys/times.h>
  6.  
  7. clock_t times(struct tms *buf);
  8. @end example
  9.  
  10. @subheading Description
  11.  
  12. This function returns the number of clock ticks used by the current
  13. process and all of its children until the moment of call.  The number
  14. of tics per second is @code{CLOCKS_PER_SEC}, defined on time.h.
  15.  
  16. This is the structure in which @code{times} returns its info:
  17.  
  18. @example
  19. struct  tms @{
  20.   clock_t tms_cstime;
  21.   clock_t tms_cutime;
  22.   clock_t tms_stime;
  23.   clock_t tms_utime;
  24. @};
  25. @end example
  26.  
  27. Currently, the elapsed time of the running program is returned in the
  28. @code{tms_utime} field, and all other fields return as zero.
  29.  
  30. @subheading Return Value
  31.  
  32. The number of elapsed tics since the program started.
  33.  
  34. @subheading Example
  35.  
  36. @example
  37. printf("We used %d seconds of elapsed time\n", times(&buf)/CLOCKS_PER_SEC);
  38. @end example
  39.  
  40.