00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __TSOFTWARECLOCKMODULE_HH
00011 #define __TSOFTWARECLOCKMODULE_HH
00012
00013 #include "Tglobals.h"
00014 #include "TSoftwareModule.hh"
00015 #include "TSystemClock.hh"
00016
00017 class TDataElement;
00018 class TSystemClock;
00019
00020 class TSoftwareClockModule
00021 : public TSoftwareModule
00022 {
00023 public:
00024 enum {
00025 tStringTime,
00026 tIntegerTime,
00027 tElapsedTimeOfLastInitialize,
00028 tElapsedTimeOfLastUpdate,
00029 tYear,
00030 tMonth,
00031 tDay,
00032 tHour,
00033 tMinute,
00034 tSecond,
00035 tNumberOfChannels
00036 };
00037
00038 private:
00039 TSystemClock theSystemClock;
00040
00041 public:
00042 TSoftwareClockModule( Tint nchannel = tNumberOfChannels );
00043 TSoftwareClockModule( const TSoftwareClockModule& right );
00044 ~TSoftwareClockModule();
00045
00046 public:
00047 const TSoftwareClockModule& operator=( const TSoftwareClockModule& right );
00048 Tbool operator==( const TSoftwareClockModule& right ) const;
00049 Tbool operator!=( const TSoftwareClockModule& right ) const;
00050
00051 public:
00052 Tint Clear();
00053 Tint Update();
00054 Tint Initialize();
00055 Tvoid FillData( TDataElement& element, Tint channel );
00056
00057 public:
00058 const TSystemClock& GetSystemClock() const;
00059 TSystemClock& GetSystemClock();
00060 Tvoid SetSystemClock( const TSystemClock& clock );
00061
00062 public:
00063 Tstring GetStringTime();
00064 Tint GetIntegerTime();
00065 Tstring WhatTimeIsItNow();
00066 Tstring WhatTimeIsIt( Tint second = -1 );
00067 Tint GetElapsedTimeOfLastInitialize( const Tstring& unit = Tsec );
00068 Tint GetElapsedTimeOfLastUpdate( const Tstring& unit = Tsec );
00069 Tint GetYear();
00070 Tint GetMonth();
00071 Tint GetDay();
00072 Tint GetHour();
00073 Tint GetMinute();
00074 Tint GetSecond();
00075
00076 };
00077
00078 inline const TSystemClock& TSoftwareClockModule::GetSystemClock() const
00079 {
00080 return( theSystemClock );
00081 }
00082
00083 inline TSystemClock& TSoftwareClockModule::GetSystemClock()
00084 {
00085 return( theSystemClock );
00086 }
00087
00088 inline Tvoid TSoftwareClockModule::SetSystemClock( const TSystemClock& clock )
00089 {
00090 theSystemClock = clock;
00091 return;
00092 }
00093
00094 inline Tstring TSoftwareClockModule::GetStringTime()
00095 {
00096 return( theSystemClock.WhatTimeIsItNow() );
00097 }
00098
00099 inline Tint TSoftwareClockModule::GetIntegerTime()
00100 {
00101 theSystemClock.Update();
00102 return( theSystemClock.GetTime() );
00103 }
00104
00105 inline Tstring TSoftwareClockModule::WhatTimeIsItNow()
00106 {
00107 return( theSystemClock.WhatTimeIsItNow() );
00108 }
00109
00110 inline Tstring TSoftwareClockModule::WhatTimeIsIt( Tint second )
00111 {
00112 return( theSystemClock.WhatTimeIsIt( second ) );
00113 }
00114
00115 inline Tint TSoftwareClockModule::GetYear()
00116 {
00117 return( theSystemClock.GetYear() );
00118 }
00119
00120 inline Tint TSoftwareClockModule::GetMonth()
00121 {
00122 return( theSystemClock.GetMonth() );
00123 }
00124
00125 inline Tint TSoftwareClockModule::GetDay()
00126 {
00127 return( theSystemClock.GetDay() );
00128 }
00129
00130 inline Tint TSoftwareClockModule::GetHour()
00131 {
00132 return( theSystemClock.GetHour() );
00133 }
00134
00135 inline Tint TSoftwareClockModule::GetMinute()
00136 {
00137 return( theSystemClock.GetMinute() );
00138 }
00139
00140 inline Tint TSoftwareClockModule::GetSecond()
00141 {
00142 return( theSystemClock.GetSecond() );
00143 }
00144
00145 inline Tint TSoftwareClockModule::GetElapsedTimeOfLastInitialize( const Tstring& unit )
00146 {
00147 return( theSystemClock.GetElapsedTime( unit ) );
00148 }
00149
00150 inline Tint TSoftwareClockModule::GetElapsedTimeOfLastUpdate( const Tstring& unit )
00151 {
00152 return( theSystemClock.GetElapsedTimeOfLastUpdate( unit ) );
00153 }
00154
00155 #endif