#if !defined(DEF_TTIMING) #define DEF_TTIMING #include class TTiming { protected: struct timeval start; struct timeval stop; void getTime(timeval &tv); public: TTiming(void); void Begin(void); long End(void); }; inline TTiming::TTiming(void) { } inline void TTiming::Begin(void) { getTime(start); } inline long TTiming::End(void) { getTime(stop); return ((stop.tv_sec-start.tv_sec) * 1000 + (stop.tv_usec-start.tv_usec)/1000.0) + 0.5; } inline void TTiming::getTime(timeval &tv) { gettimeofday(&tv,NULL); } #endif