00001 00012 #ifndef __TIMER_H__ 00013 #define __TIMER_H__ 00014 00015 #include <sys/time.h> 00016 00020 #define SEC_PER_DAY 24*60*60 00021 00025 #define USEC_PER_SEC 1000*1000 00026 00030 class Timer { 00031 public: 00036 Timer(); 00037 00043 float getTime(); 00044 00050 const char* getTimeStr(); 00051 00055 void print(); 00056 00060 void reset(); 00061 00072 char* toStr(long num, long maxNum); 00073 00074 private: 00078 struct itimerval time; 00079 00080 }; 00081 00082 #endif // ! __TIMER_H__