5 * Revision 1.1.1.1 1996/02/15 17:49:31 mclareni
10 CERN PROGLIB# Z007 TIMEST .VERSION KERNIRT 1.06 930811
11 ORIG. 01/03/85 FCA, mod 02/06/93 GF
13 #include <sys/types.h>
15 #include <sys/times.h>
16 #include <sys/param.h>
18 #include <sys/resource.h>
21 #define RLIMIT_CPU 0 /* For HP-UX... */
24 #define RLIM_INFINITY 0x7fffffff /* For HP-UX... */
27 #if defined(CERNLIB_QSYSBSD)
33 static time_t timstart, timlast;
34 static int tml_init = 1;
37 #if defined(CERNLIB_QX_SC)
38 #define timest timest_
43 #if defined(CERNLIB_QXCAPT)
50 /* local routine called by timst, and time_init */
51 static void time_st(timl)
56 timstart = tps.tms_utime+tps.tms_cutime;
61 /* local routine to start by default */
62 static void time_init()
69 if (getrlimit(RLIMIT_CPU, &rlimit)==0) {
70 if ( rlimit.rlim_cur != RLIM_INFINITY )
71 maxtime = (float) rlimit.rlim_cur;
86 /* get maximum time allowed by system, and do not allow more */
88 if (getrlimit(RLIMIT_CPU, &rlimit)==0) {
89 maxtime = (float) rlimit.rlim_cur;
90 maxtime = ( maxtime > *timl ) ? *timl : maxtime;
99 CERN PROGLIB# Z007 TIMEX .VERSION KERNIRT 1.06 930811
111 timnow = tps.tms_utime+tps.tms_cutime;
112 *tx = (float) (timnow - timstart) / HZ;
120 CERN PROGLIB# Z007 TIMED .VERSION KERNIRT 1.06 930811
132 timnow = tps.tms_utime+tps.tms_cutime;
133 *td = (float) (timnow - timlast) / HZ;
142 CERN PROGLIB# Z007 TIMEL .VERSION KERNIRT 1.06 930811
154 timnow = tps.tms_utime+tps.tms_cutime;
155 *tl = timlim - (float) (timnow - timstart) / HZ;
159 /*> END <----------------------------------------------------------*/