Annotation of 42BSD/usr.lib/libU77/etime_.c, revision 1.1.1.1

1.1       root        1: /*
                      2: char id_etime[] = "@(#)etime_.c        1.1";
                      3:  *
                      4:  * Return the elapsed execution time for this process.
                      5:  *
                      6:  * calling sequence:
                      7:  *     real time(2)
                      8:  *     call etime (time)
                      9:  * where:
                     10:  *     the 2 element array, time, will receive the user and system
                     11:  *     elapsed time since the start of execution.
                     12:  *
                     13:  *     This routine can be called as function, and returns the sum of
                     14:  *     user and system times. The time array argument must always be given.
                     15:  *
                     16:  *     The resolution for all timing is 1/60 second.
                     17:  */
                     18: 
                     19: #include <sys/types.h>
                     20: #include <sys/times.h>
                     21: 
                     22: struct tb { float usrtime; float systime; };
                     23: 
                     24: float
                     25: etime_(et) struct tb *et;
                     26: {      struct tms clock;
                     27: 
                     28:        times(&clock);
                     29:        et->usrtime = (float) clock.tms_utime / 60.0;
                     30:        et->systime = (float) clock.tms_stime / 60.0;
                     31:        return(et->usrtime + et->systime);
                     32: }

unix.superglobalmegacorp.com

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