00001 #ifndef TIMER_H
00002 #define TIMER_H
00003
00004 #include <ctime>
00005 #include <iostream>
00006 #include <iomanip>
00007 #include "util.h"
00008
00009 class Timer
00010 {
00011 friend std::ostream& operator<<(std::ostream& os, Timer& t);
00012
00013 private:
00014 bool running;
00015 time_t start_time;
00016
00017
00018 double elapsed_time();
00019
00020 public:
00021
00022
00023
00024
00025 Timer() : running(false), start_time(0) { }
00026
00027 void start(const char* msg = 0);
00028
00029
00030 void check(const char* msg = 0);
00031 double get_elapsed_time();
00032
00033 };
00034
00035 #endif // TIMER_H