Annotation of 42BSD/lib/libc/compat-4.1/times.c, revision 1.1.1.1

1.1       root        1: /*     times.c 4.2     83/06/02        */
                      2: 
                      3: #include <sys/time.h>
                      4: #include <sys/resource.h>
                      5: 
                      6: /*
                      7:  * Backwards compatible times.
                      8:  */
                      9: struct tms {
                     10:        int     tms_utime;              /* user time */
                     11:        int     tms_stime;              /* system time */
                     12:        int     tms_cutime;             /* user time, children */
                     13:        int     tms_cstime;             /* system time, children */
                     14: };
                     15: 
                     16: times(tmsp)
                     17:        register struct tms *tmsp;
                     18: {
                     19:        struct rusage ru;
                     20: 
                     21:        if (getrusage(RUSAGE_SELF, &ru) < 0)
                     22:                return (-1);
                     23:        tmsp->tms_utime = scale60(&ru.ru_utime);
                     24:        tmsp->tms_stime = scale60(&ru.ru_stime);
                     25:        if (getrusage(RUSAGE_CHILDREN, &ru) < 0)
                     26:                return (-1);
                     27:        tmsp->tms_cutime = scale60(&ru.ru_utime);
                     28:        tmsp->tms_cstime = scale60(&ru.ru_stime);
                     29:        return (0);
                     30: }
                     31: 
                     32: static
                     33: scale60(tvp)
                     34:        register struct timeval *tvp;
                     35: {
                     36: 
                     37:        return (tvp->tv_sec * 60 + tvp->tv_usec / 16667);
                     38: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.