home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume12 / postscript / part01 / source / misc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-10-27  |  886 b   |  35 lines

  1. /*
  2.  * Copyright (C) Rutherford Appleton Laboratory 1987
  3.  * 
  4.  * This source may be copied, distributed, altered or used, but not sold for profit
  5.  * or incorporated into a product except under licence from the author.
  6.  * It is not in the public domain.
  7.  * This notice should remain in the source unaltered, and any changes to the source
  8.  * made by persons other than the author should be marked as such.
  9.  * 
  10.  *    Crispin Goswell @ Rutherford Appleton Laboratory caag@uk.ac.rl.vd
  11.  */
  12. #include "main.h"
  13. #include <sys/param.h>
  14. #include <sys/times.h>
  15. #ifndef HZ
  16. #    define HZ 60
  17. #endif
  18.  
  19. static int PUserTime ();
  20.      
  21. InitMisc ()
  22.  {
  23.       InstallOp ("usertime",    PUserTime,    0, 1, 0, 0);
  24.      InstallOp ("==",     PolyFirst,     1, 1, 0, 0, Poly);
  25.   }
  26.  
  27. static int PUserTime ()
  28.  {
  29.      struct tms tbuf;
  30.      long times ();
  31.      
  32.     times (&tbuf);
  33.      return Push (OpStack, MakeInteger ((int) (tbuf.tms_utime * 1000 / HZ)));
  34.  }
  35.