00001 #ifndef __CTime__ 00002 #define __CTime__ 00003 00004 #include "../Basics/CString.hpp" 00005 using Exponent::Basics::CString; 00006 00007 // =========================================================================== 00008 00009 namespace Exponent 00010 { 00011 namespace Host 00012 { 00033 class CTime : public CCountedObject 00034 { 00036 EXPONENT_CLASS_DECLARATION; 00039 // =========================================================================== 00040 00041 public: 00042 00043 // =========================================================================== 00044 00045 const static char *CTIME_DAY_OF_THE_WEEK[]; 00046 const static char *CTIME_MONTH_OF_THE_YEAR[]; 00048 // =========================================================================== 00049 00053 CTime(); 00055 #ifdef WIN32 00056 00061 CTime(FILETIME &fileTime); 00063 #else 00064 00069 CTime(DateTimeRec &time); 00071 #endif 00072 00078 CTime(const CTime &time); 00079 00083 virtual ~CTime(); 00084 00085 // =========================================================================== 00086 00092 virtual CTime &operator = (const CTime &time); 00093 00094 // =========================================================================== 00096 #ifdef WIN32 00097 00102 void setTime(FILETIME &fileTime); 00104 #else 00105 00110 void setTime(DateTimeRec &time); 00112 #endif 00113 00118 void setToCurrentTime(); 00119 00120 // =========================================================================== 00121 00126 unsigned short getYear() const { return m_year; } 00127 00132 unsigned short getMonth() const { return m_month; } 00133 00138 unsigned short getDayOfWeek() const { return m_dayOfWeek; } 00139 00144 unsigned short getDay() const { return m_day; } 00145 00150 unsigned short getHour() const { return m_hour; } 00151 00156 unsigned short getMinutes() const { return m_minutes; } 00157 00162 unsigned short getSeconds() const { return m_seconds; } 00163 00168 unsigned short getMilliseconds() const { return m_milliseconds; } 00169 00170 // =========================================================================== 00171 00176 void setYear(const unsigned short year) { m_year = year; } 00177 00182 void setMonth(const unsigned short month) { m_month = month; } 00183 00188 void setDayOfWeek(const unsigned short dayOfWeek) { m_dayOfWeek = dayOfWeek; } 00189 00194 void setDay(const unsigned short day) { m_day = day; } 00195 00200 void setHour(const unsigned short hour) { m_hour = hour; } 00201 00206 void setMinutes(const unsigned short minutes) { m_minutes = minutes; } 00207 00212 void setSeconds(const unsigned short seconds) { m_seconds = seconds; } 00213 00218 void setMilliseconds(const unsigned short milliseconds) { m_milliseconds = milliseconds; } 00219 00220 // =========================================================================== 00221 00227 virtual void getObjectDescription(char *string, const long size) const; 00228 00229 // =========================================================================== 00230 00236 CString getDayYearString(const bool stringFormat = true) const; 00237 00242 CString getTimeOnly() const; 00244 #ifdef WIN32 00245 00250 FILETIME *getFileTime(); 00252 #else 00253 00258 DateTimeRec *getFileTime(); 00260 #endif 00261 00263 // =========================================================================== 00264 00265 protected: 00266 00267 // =========================================================================== 00269 #ifdef WIN32 00270 00275 void setTime(SYSTEMTIME &time); 00277 #endif 00278 00280 // =========================================================================== 00281 00282 unsigned short m_year; 00283 unsigned short m_month; 00284 unsigned short m_dayOfWeek; 00285 unsigned short m_day; 00286 unsigned short m_hour; 00287 unsigned short m_minutes; 00288 unsigned short m_seconds; 00289 unsigned short m_milliseconds; 00290 }; 00291 } 00292 } 00293 #endif // End of CTime.hpp