00001 // ===================================================================== 00028 // ===================================================================== 00029 #ifndef CLDAQ__TSYSTEMCLOCK_HH 00030 #define CLDAQ__TSYSTEMCLOCK_HH 00031 00032 #include "Tglobals.h" 00033 00053 class TSystemClock 00054 { 00055 00056 private: 00057 // elapsed time in second from 1970/1/1/00:00:00 00058 // 現在時刻を聞いたら,必ず theLastRequiredTime = theTime これがUpdate() 00059 // 任意の時刻を尋ねてもこれは起こらない 00060 Tint theAllocatedTime; 00061 Tint theLastUpdateTime; 00062 Tint theTime; 00063 00064 public: 00065 TSystemClock(); 00066 TSystemClock( const TSystemClock& right ); 00067 ~TSystemClock(); 00068 00069 public: 00070 const TSystemClock& operator=( const TSystemClock& right ); 00071 friend Tostream& operator<<( Tostream& tos, const TSystemClock& right ); 00072 00073 public: 00074 Tstring WhatTimeIsItNow(); 00075 Tstring WhatTimeIsIt( Tint second = -1 ); 00076 Tstring WhenAllocated(); 00077 Tstring WhenUpdate(); 00078 Tint GetElapsedTime( const Tstring& unit = Tsec ); 00079 Tint GetElapsedTimeOfLastUpdate( const Tstring& unit = Tsec ); 00080 Tint GetYear( Tint second = -1 ); 00081 Tint GetMonth( Tint second = -1 ); 00082 Tint GetDay( Tint second = -1 ); 00083 Tint GetHour( Tint second = -1 ); 00084 Tint GetMinute( Tint second = -1 ); 00085 Tint GetSecond( Tint second = -1 ); 00086 Tint Update(); 00087 00088 public: 00089 Tint GetAllocatedTime() const; 00090 Tint GetLastUpdateTime() const; 00091 Tint GetTime() const; 00092 00093 #ifdef __CLDAQ_ROOT_DLL 00094 ClassDef(TSystemClock,0) 00095 #endif 00096 00097 }; 00098 00099 inline Tint TSystemClock::GetAllocatedTime() const 00100 { 00101 return theAllocatedTime; 00102 } 00103 00104 inline Tint TSystemClock::GetLastUpdateTime() const 00105 { 00106 return theLastUpdateTime; 00107 } 00108 00109 inline Tint TSystemClock::GetTime() const 00110 { 00111 return theTime; 00112 } 00113 00114 #endif