00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __XVR2_DATE_H__
00015 #define __XVR2_DATE_H__
00016 #include<xvr2/System.h>
00017 #include<sys/types.h>
00018 #include<xvr2/String.h>
00019 #include<xvr2/CoreExceptions.h>
00020
00021 namespace xvr2{
00022
00026 class Date:public System{
00027 protected:
00029 time_t unixtime;
00032
00033 void setTStamp(UInt32 tstamp);
00034 void decode(const char *format, const char *date_text);
00035 virtual void encode();
00036 std::string *string_representation;
00037 public:
00038 enum DateAMPM{
00039 AM,
00040 PM
00041 };
00042 enum DateARITHParts{
00043 DAYS,
00044 HOURS,
00045 MINUTES,
00046 SECONDS
00047 };
00049 int hour;
00051 int hr12hour;
00053 int minute;
00055 int second;
00057 int dayofweek;
00059 int dayofyear;
00061 int dayofmonth;
00063 int month;
00065 int year;
00067 int hr12ampm;
00068
00070 Date();
00074 Date(UInt32 __unixtime);
00084 Date(int __y, int __m, int __dw, int __dm, int __h, int __mi, int __s = 0);
00093 Date(const char *format, const char *date_text);
00102 Date(const String &format, const String &date_text);
00103 Date(const Date &d);
00104 Date(const Date *d);
00105 virtual ~Date();
00106 Date &operator=(const Date &_d);
00108 virtual time_t getCurrentTime();
00109
00112 const UInt32 unixTime();
00113 const UInt32 unixTime() const;
00118 virtual std::string toString();
00119 virtual void add(DateARITHParts component, int value);
00120 static Date Now();
00121 };
00122
00123 }
00124
00125
00126 #endif