timeUtilities.h

Go to the documentation of this file.
00001 
00015 #ifndef DLR_UTILITIES_TIMEUTILITIES_H
00016 #define DLR_UTILITIES_TIMEUTILITIES_H
00017 
00018 #include <dlrPortability/timeUtilities.h>
00019 
00020 namespace dlr {
00021 
00022   namespace utilities {
00023     
00029     using portability::getCurrentTime;
00030 
00031     
00038     using portability::portableSleep;
00039 
00040 
00045     class Timer {
00046     public:
00047 
00053       Timer()
00054         : m_startTime(0.0) {this->reset();}
00055 
00056     
00060       ~Timer() {}
00061 
00062 
00069       double
00070       getElapsedTime() {return getCurrentTime() - m_startTime;}
00071 
00072 
00079       double
00080       reset() {
00081         double t0 = m_startTime;
00082         m_startTime = getCurrentTime();
00083         return m_startTime - t0;
00084       }
00085 
00086     private:
00087       
00088       double m_startTime;
00089       
00090     }; // class Timer
00091     
00092   } // namespace utilities
00093   
00094 } // namespace dlr
00095 
00096 
00097 /* ======= Declarations to maintain compatibility with legacy code. ======= */
00098 
00099 namespace dlr {
00100 
00101   using utilities::getCurrentTime;
00102   using utilities::portableSleep;
00103   
00104 } // namespace dlr
00105 
00106 #endif /* #ifndef DLR_UTILITIES_TIMEUTILITIES_H */

Generated on Wed Nov 25 11:07:09 2009 for dlrUtilities Utility Library by  doxygen 1.5.8