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

1.1       root        1: /*
                      2:  * Copyright (c) 1980 Regents of the University of California.
                      3:  * All rights reserved.  The Berkeley software License Agreement
                      4:  * specifies the terms and conditions for redistribution.
                      5:  *
                      6:  *     @(#)etime_.c    5.1     6/7/85
                      7:  */
                      8: 
                      9: /*
                     10:  * Return the elapsed execution time for this process.
                     11:  *
                     12:  * calling sequence:
                     13:  *     real time(2)
                     14:  *     call etime (time)
                     15:  * where:
                     16:  *     the 2 element array, time, will receive the user and system
                     17:  *     elapsed time since the start of execution.
                     18:  *
                     19:  *     This routine can be called as function, and returns the sum of
                     20:  *     user and system times. The time array argument must always be given.
                     21:  *
                     22:  *     The resolution for all timing is 1/60 second.
                     23:  */
                     24: 
                     25: #include <sys/types.h>
                     26: #include <sys/times.h>
                     27: 
                     28: struct tb { float usrtime; float systime; };
                     29: 
                     30: float
                     31: etime_(et) struct tb *et;
                     32: {      struct tms clock;
                     33: 
                     34:        times(&clock);
                     35:        et->usrtime = (float) clock.tms_utime / 60.0;
                     36:        et->systime = (float) clock.tms_stime / 60.0;
                     37:        return(et->usrtime + et->systime);
                     38: }

unix.superglobalmegacorp.com

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