PCMTimer.h
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00027 
00028 #ifndef __PCM_TIMER_H__
00029 #  define __PCM_TIMER_H__
00030 
00031 
00032 
00033 
00034 
00035 #  include "PCMPremeditations.h"
00036 
00037 
00038 
00039 
00040 
00041 #  include <string>
00042 
00043 #  include <sys/time.h>
00044 
00045 
00046 
00047 
00048 
00049 #  include <squirrel/squirrel.h>
00050 #  include <squirrel/sqstdio.h>
00051 #  include <squirrel/sqstdaux.h>
00052 #  include <squirrel/sqplus.h>
00053 
00054 namespace ParCompMark
00055 {
00056 
00061   class Timer
00062   {
00063 
00064         
00065         
00066         
00067 #  ifdef PARCOMPMARK_TEST
00068         friend class ParCompMarkTest::TestTimer;
00069 #  endif
00070 
00071         
00072         
00073         
00074 
00076 
00077 
00085    public:static void squirrelGlue()
00086         {
00087          ::SqPlus::SQClassDef < Timer > (_T("Timer")).staticFunc(&Timer::getSystemTime,
00088                                                                  _T("getSystemTime")).
00089                 staticFunc(&Timer::getApplicationTime, _T("getApplicationTime")).staticFunc(&Timer::sleep, _T("sleep"));
00090         }
00091 
00093 
00094         
00095         
00096         
00097 
00099 
00100 
00101    public:
00102 
00108         static const Real EPSILONDELAY;
00109 
00111 
00112         
00113         
00114         
00115 
00117 
00118 
00119    protected:
00120 
00126         static Real mTimeCorrection;
00127 
00133         static Real mStartTime;
00134 
00136 
00137         
00138         
00139         
00140 
00142 
00143 
00144    public:
00145 
00151         static const Real & getTimeCorrection();
00152 
00158         static void setTimeCorrection(const Real & timecorrection);
00159 
00165         static const Real & getStartTime();
00166 
00168 
00169         
00170         
00171         
00172 
00174 
00175 
00176    public:
00177 
00182         static Real getSystemTime();
00183 
00188         static Real getApplicationTime();
00189 
00194         static Real getUncorrectedSystemTime();
00195 
00205         static std::string getTimeString(const bool & microseconds = true, const bool & seconds =
00206                                          true, const bool & minutes = true, const bool & hours =
00207                                          true, const Real & correction = 0.0);
00208 
00217         static std::string getDateString(const bool & days = true, const bool & months =
00218                                          true, const bool & years = true, const Real & correction = 0.0);
00219 
00232         static std::string getTimeDateString(const bool & microseconds = true, const bool & seconds =
00233                                           true, const bool & minutes = true, const bool & hours =
00234                                           true, const bool & days = true, const bool & months =
00235                                           true, const bool & years = true, const Real & correction =
00236                                           0.0);
00237 
00242         static void sleep(const Real time);
00243 
00245 
00246   };
00247 
00248   
00249   
00250   
00251 
00252 #  include "PCMTimer_impl.h"
00253 
00254 }
00255 
00256 
00258 DECLARE_INSTANCE_TYPE_NAME(ParCompMark::Timer, Timer);
00259 
00260 #endif