00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef SIMPLETIME_H
00015 #define SIMPLETIME_H
00016
00017 namespace ssobjects
00018 {
00019
00020 typedef const char* PTIMESTRING;
00021
00022 #define SECS_PER_MIN 60
00023 #define SECS_PER_HOUR 3600
00024 #define SECS_PER_DAY (86400) //SECSperHOUR*24
00025
00026 class CSimpleTime
00027 {
00028 public:
00029 unsigned m_currentTime;
00030 unsigned m_hour;
00031 unsigned m_minute;
00032 unsigned m_second;
00033 char m_szFormated[80];
00034
00035 public:
00036 CSimpleTime();
00037 CSimpleTime(const char* szTime);
00038 CSimpleTime(unsigned seconds);
00039
00040 protected:
00041 void FormatOutput();
00042 void SetTime();
00043
00044
00045 public:
00046 static unsigned GetCurrentTime();
00047 static unsigned Convert(unsigned hour,unsigned minute,unsigned second);
00048 static bool IsValid(unsigned time) {return time < SECS_PER_DAY ? true:false;}
00049
00050 virtual unsigned GetHour();
00051 virtual unsigned GetMinute();
00052 virtual unsigned GetSecond();
00053
00054
00055 operator unsigned() const {return m_currentTime;}
00056 operator PTIMESTRING();
00057
00058 CSimpleTime& operator = (const char* time);
00059 CSimpleTime& operator = (const unsigned time);
00060
00061
00062 CSimpleTime operator += (const unsigned time);
00063 CSimpleTime operator -= (const unsigned time);
00064
00065 bool operator == (const unsigned time) const;
00066 bool operator < (const unsigned time) const;
00067 bool operator > (const unsigned time) const;
00068 bool operator <= (const unsigned time) const;
00069 bool operator >= (const unsigned time) const;
00070
00071 bool operator == (const CSimpleTime& time) const;
00072 bool operator < (const CSimpleTime& time) const;
00073 bool operator > (const CSimpleTime& time) const;
00074 bool operator <= (const CSimpleTime& time) const;
00075 bool operator >= (const CSimpleTime& time) const;
00076 };
00077
00078 };
00079
00080 #endif