00001
00002 #ifndef DDF_STOPWATCH_HPP
00003 #define DDF_STOPWATCH_HPP
00004
00005 #include "ctime.hpp"
00006
00007 namespace jafar
00008 {
00009 namespace ddf
00010 {
00011
00017 class StopWatch
00018 {
00019 time m_start_time;
00020
00021 public:
00022 StopWatch() { m_start_time = time::current(); }
00023 ~StopWatch() {}
00024
00025 time Restart() { m_start_time = time::current(); return m_start_time; }
00026 time GetStartTime() { return m_start_time; }
00027 time Elapsed() { return time::current() - m_start_time; }
00028 time ElapsedAndReset() { time res, current = time::current(); res = current - m_start_time; m_start_time = current; return res; }
00029 double ElapsedSec()
00030 {
00031 time elapsed = Elapsed();
00032 return elapsed.to_double();
00033 }
00034
00035 };
00036
00037 }
00038 }
00039 #endif