home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / presto / prest_04.lha / src / timer.h < prev   
Encoding:
C/C++ Source or Header  |  1989-06-06  |  608 b   |  34 lines

  1. /*
  2.  * Generic clock interface
  3.  */
  4.  
  5.  
  6. #ifndef ITIMER_REAL
  7. #include <sys/time.h>
  8. #endif
  9.  
  10. extern int gettimeofday(struct timeval*, struct timezone*);
  11.  
  12. class Timer : public Object    {
  13.     double t_starttime;
  14.     struct timeval t_time;
  15. public:
  16.  
  17.     Timer()
  18.         {;}                // satisfy compiler
  19.     void init();                // intentional ctor only
  20.     ~Timer();
  21.     struct timeval* gettimeofday();
  22.     double getabsolutetime();
  23.     char *getasciitime();
  24.     void  timerstart()
  25.         { t_starttime = getabsolutetime(); }
  26.     void reinit()
  27.         { timerstart(); }
  28.     double timermark()
  29.         { return getabsolutetime() - t_starttime; }
  30.     virtual void print(ostream& = cout);
  31. };
  32.  
  33.  
  34.