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: 
   7: #if defined(LIBC_SCCS) && !defined(lint)
   8: static char sccsid[] = "@(#)times.c	5.2 (Berkeley) 3/9/86";
   9: #endif LIBC_SCCS and not lint
  10: 
  11: #include <sys/time.h>
  12: #include <sys/resource.h>
  13: #include <sys/types.h>
  14: #include <sys/times.h>
  15: 
  16: times(tmsp)
  17:     register struct tms *tmsp;
  18: {
  19:     struct rusage ru;
  20:     long scale60();
  21: 
  22:     if (getrusage(RUSAGE_SELF, &ru) < 0)
  23:         return (-1);
  24:     tmsp->tms_utime = scale60(&ru.ru_utime);
  25:     tmsp->tms_stime = scale60(&ru.ru_stime);
  26:     if (getrusage(RUSAGE_CHILDREN, &ru) < 0)
  27:         return (-1);
  28:     tmsp->tms_cutime = scale60(&ru.ru_utime);
  29:     tmsp->tms_cstime = scale60(&ru.ru_stime);
  30:     return (0);
  31: }
  32: 
  33: static long
  34: scale60(tvp)
  35:     register struct timeval *tvp;
  36: {
  37: 
  38:     return (tvp->tv_sec * 60 + tvp->tv_usec / 16667);
  39: }
Last modified: 1987-03-13
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: ?E00
Valid CSS Valid XHTML 1.0 Strict