Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

GDateTime.h

Go to the documentation of this file.
00001 
00002 
00003 #ifndef __DATE_TIME_H
00004 #define __DATE_TIME_H
00005 
00006 #define GDTF_DEFAULT                0
00007     
00008 #define GDTF_DAY_MONTH_YEAR         0x01
00009 #define GDTF_MONTH_DAY_YEAR         0x02
00010 #define GDTF_YEAR_DAY_MONTH         0x04
00011 #define GDTF_DATE_MASK              0x0f
00012 
00013 #define GDTF_12HOUR                 0x10
00014 #define GDTF_24HOUR                 0x20
00015 #define GDTF_TIME_MASK              0xf0
00016 
00018 class LgiClass GDateTime
00019 {
00020     int16 _Day;         // 1-DaysInMonth
00021     int16 _Year;        // ####
00022     int16 _Thousands;   // 0-999
00023 
00024     int16 _Month;       // 1-12
00025     int16 _Seconds;     // 0-59
00026     int16 _Minutes;     // 0-59
00027     int16 _Hours;       // 0-23     (24hr)
00028 
00029     uchar _Format;
00030     static uchar DefaultFormat;
00031 
00032 public:
00033     GDateTime();
00034     ~GDateTime();
00035 
00036     // Date access
00037 
00039     int Day() { return _Day; }
00041     void Day(int d) { _Day = d; }
00043     int Month() { return _Month; }
00045     void Month(int m) { _Month = m; }
00047     int Year() { return _Year; }
00049     void Year(int y) { _Year = y; }
00050 
00051     // Time access
00052     int Thousands() { return _Thousands; }
00053     void Thousands(int t) { _Thousands = t; }
00054     int Seconds() { return _Seconds; }
00055     void Seconds(int s) { _Seconds = s; }
00056     int Minutes() { return _Minutes; }
00057     void Minutes(int m) { _Minutes = m; }
00058     int Hours() { return _Hours; }
00059     void Hours(int h) { _Hours = h; }
00060 
00061     // Format
00062     uchar GetFormat() { return _Format; }
00063     void SetFormat(uchar f) { _Format = f; }
00064     static uchar GetDefaultFormat();
00065     static void SetDefaultFormat(uchar f) { DefaultFormat = f; }
00066 
00067     // Calculated properties
00068     int DayOfWeek();
00069 
00070     // Misc
00071 
00073     void Get(char *Str);
00075     bool Get(int64 &s);
00077     void GetDate(char *Str);
00079     void GetTime(char *Str);
00080 
00082     void SetNow();
00084     bool Set(char *Str);
00086     bool Set(int64 s);
00088     bool SetDate(char *Str);
00090     bool SetTime(char *Str);
00091 
00092     // Methods
00093     bool IsLeapYear(int Year = -1);
00094     bool IsSameDay(GDateTime &d);
00095     int DaysInMonth();
00096     void AddMinutes(int Minutes);
00097     void AddHours(int Hours);
00098     void AddDays(int Days);
00099     void AddMonths(int Months);
00100     int TimeZone();         // -60 * timezone
00101     int TimeZoneOffset();   // e.g. daylight savings
00102     
00103     // File
00104     int Sizeof();
00105     bool Serialize(class GFile &f, bool Write);
00106     bool Serialize(class ObjProperties *Props, char *Name, bool Write);
00107 
00108     // operators
00109     bool operator <(GDateTime &dt);
00110     bool operator <=(GDateTime &dt);
00111     bool operator >(GDateTime &dt);
00112     bool operator >=(GDateTime &dt);
00113     bool operator ==(GDateTime &dt);
00114     bool operator !=(GDateTime &dt);
00115     int Compare(GDateTime *d);
00116 
00117     GDateTime operator -(GDateTime &dt);
00118     GDateTime operator +(GDateTime &dt);
00119     GDateTime DiffMonths(GDateTime &dt);
00120 };
00121 
00122 struct GTimeZone
00123 {
00124 public:
00125     float Offset;
00126     char *Text;
00127 };
00128 
00129 extern GTimeZone GTimeZones[];
00130 
00131 #endif

Generated on Wed Oct 26 14:46:48 2005 for Lgi by  doxygen 1.4.1