home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
zip
/
mint
/
mntlib16.lzh
/
MNTLIB16
/
TIMES.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-03
|
787b
|
38 lines
#include <sys/times.h>
#include <time.h>
#include <mintbind.h>
extern int __mint;
extern long _childtime;
/* macro to convert milliseconds into CLK_TCKs */
#define CVRT(x) ((x)/((1000L/CLK_TCK)))
int
times(buffer)
struct tms *buffer;
{
long usage[8], r, real_time;
real_time = clock();
if (__mint) {
r = Prusage(usage);
if (r >= 0 && buffer) {
buffer->tms_cutime = CVRT(usage[3]);
buffer->tms_cstime = CVRT(usage[2]);
buffer->tms_utime = CVRT(usage[1]);
buffer->tms_stime = CVRT(usage[0]);
return real_time;
}
}
if (buffer) {
buffer->tms_cstime = (time_t) 0;
buffer->tms_cutime = (time_t) _childtime;
buffer->tms_stime = (time_t) 0;
buffer->tms_utime = (time_t) real_time - _childtime;
}
return real_time;
}