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