home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / TIME / TIMES.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  518 b   |  22 lines

  1. /* times.c (emx+gcc) -- Copyright (c) 1990-1993 by Eberhard Mattes */
  2.  
  3. #include <sys/emx.h>
  4. #include <time.h>
  5. #include <sys/time.h>
  6. #include <sys/times.h>
  7.  
  8. /* Note: return value overflows */
  9.  
  10. long times (struct tms *buffer)
  11. {
  12.   struct timeval tv;
  13.  
  14.   buffer->tms_utime = clock () / CLOCKS_PER_SEC;
  15.   buffer->tms_stime = 0;
  16.   buffer->tms_cutime = 0;
  17.   buffer->tms_cstime = 0;
  18.   if (gettimeofday (&tv, NULL) != 0)
  19.     return (-1);
  20.   return (CLK_TCK * tv.tv_sec + (CLK_TCK * tv.tv_usec) / 1000000);
  21. }
  22.