00001 // ===================================================================== 00002 // $Id: TSystemClock.hh,v 1.1.1.1 2003/06/27 02:56:42 goiwai Exp $ 00003 // $Name: CLDAQ-1-06-00 $ 00004 // ===================================================================== 00005 #ifndef __TSYSTEMCLOCK_HH 00006 #define __TSYSTEMCLOCK_HH 00007 00008 #include "Tglobals.h" 00009 00010 class TSystemClock 00011 { 00012 00013 private: 00014 // elapsed time in second from 1970/1/1/00:00:00 00015 // 現在時刻を聞いたら,必ず theLastRequiredTime = theTime これがUpdate() 00016 // 任意の時刻を尋ねてもこれは起こらない 00017 Tint theAllocatedTime; 00018 Tint theLastUpdateTime; 00019 Tint theTime; 00020 00021 public: 00022 TSystemClock(); 00023 TSystemClock( const TSystemClock& right ); 00024 ~TSystemClock(); 00025 00026 public: 00027 const TSystemClock& operator=( const TSystemClock& right ); 00028 friend Tostream& operator<<( Tostream& tos, const TSystemClock& right ); 00029 00030 public: 00031 Tstring WhatTimeIsItNow(); 00032 Tstring WhatTimeIsIt( Tint second = -1 ); 00033 Tstring WhenAllocated(); 00034 Tstring WhenUpdate(); 00035 Tint GetElapsedTime( const Tstring& unit = Tsec ); 00036 Tint GetElapsedTimeOfLastUpdate( const Tstring& unit = Tsec ); 00037 Tint GetYear( Tint second = -1 ); 00038 Tint GetMonth( Tint second = -1 ); 00039 Tint GetDay( Tint second = -1 ); 00040 Tint GetHour( Tint second = -1 ); 00041 Tint GetMinute( Tint second = -1 ); 00042 Tint GetSecond( Tint second = -1 ); 00043 Tint Update(); 00044 00045 public: 00046 Tint GetAllocatedTime() const; 00047 Tint GetLastUpdateTime() const; 00048 Tint GetTime() const; 00049 00050 }; 00051 00052 inline Tint TSystemClock::GetAllocatedTime() const 00053 { 00054 return( theAllocatedTime ); 00055 } 00056 00057 inline Tint TSystemClock::GetLastUpdateTime() const 00058 { 00059 return( theLastUpdateTime ); 00060 } 00061 00062 inline Tint TSystemClock::GetTime() const 00063 { 00064 return( theTime ); 00065 } 00066 00067 #endif