00001 #ifndef STOPWATCH_H 00002 #define STOPWATCH_H 00003 00004 #include <sys/time.h> 00005 #include <time.h> 00006 00015 class stopwatch { 00016 00017 public: 00018 00021 stopwatch() : s() {}; 00022 00030 void start(); 00031 00037 double time(); 00038 00044 double stop(); 00045 00046 private: 00047 timeval s, tmp; 00048 double t; 00049 00050 }; 00051 00052 #endif