1 /**************************************************************************
2 ** (c) Copyright 1999, Andromeda Technology & Automation
3 ***************************************************************************
4 ** MODULE INFORMATION *
5 ***********************
7 ** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation
8 ** VERSION NUMBER : $Revision: 1.2 $
15 ***************************************************************************
16 ** ADMINISTRATIVE INFORMATION *
17 ********************************
18 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
19 ** CREATION DATE : Feb 06, 1998
20 ** LAST UPDATE : Oct 16, 1999
22 **************************************************************************/
24 /*****************************
26 Revision 1.2 2002-09-02 06:18:20 arjen
27 Fixed some date and time conversion functions
29 Revision 1.1 2002/07/25 08:01:26 arjen
30 First checkin, AXE release 0.2
32 *****************************/
34 /* static const char *RCSID = "$Id: date.h,v 1.2 2002-09-02 06:18:20 arjen Exp $"; */
43 unsigned char month, day;
48 date add(unsigned long days);
50 date subtract(unsigned long days);
61 date(unsigned d, unsigned m=0, short y=0)
70 friend date operator+(date, date);
71 friend date operator+(unsigned long, date);
72 friend date operator+(date, unsigned long);
74 date operator += (date D)
79 date operator += (unsigned long l)
84 friend date operator-(unsigned long, date);
85 friend date operator-(date, unsigned long);
86 friend long operator-(date&, date&);
88 date operator -= (unsigned long l)
93 // long(date); // Calculate nr. of days since...
95 int operator==(date d)
99 cm = this->year - d.year;
100 cm = (cm != 0) ? cm : this->month - d.month;
101 cm = (cm != 0) ? cm : this->day - d.day;
106 int operator!=(date d)
110 cm = this->year - d.year;
111 cm = (cm != 0) ? cm : this->month - d.month;
112 cm = (cm != 0) ? cm : this->day - d.day;
117 int operator<=(date d)
121 cm = this->year - d.year;
122 cm = (cm != 0) ? cm : this->month - d.month;
123 cm = (cm != 0) ? cm : this->day - d.day;
128 int operator>=(date d)
132 cm = this->year - d.year;
133 cm = (cm != 0) ? cm : this->month - d.month;
134 cm = (cm != 0) ? cm : this->day - d.day;
139 int operator>(date d)
143 cm = this->year - d.year;
144 cm = (cm != 0) ? cm : this->month - d.month;
145 cm = (cm != 0) ? cm : this->day - d.day;
150 int operator<(date d)
154 cm = this->year - d.year;
155 cm = (cm != 0) ? cm : this->month - d.month;
156 cm = (cm != 0) ? cm : this->day - d.day;
173 String MonthName(void);
182 unsigned DaysInMonth();
184 // date operator*(double)
185 // date& operator*=(double)
186 // date operator/(double)
187 // date& operator/=(double)
189 friend ostream& operator<<(ostream&, const date&);
190 friend istream& operator>>(istream&, date&);
192 String format(const char *fmt = "%F");
200 short minutes, seconds;
211 hour(int hr, short minute, short sec)
220 friend hour operator+(hour &, hour &);
221 hour operator += (hour h);
222 friend hour operator-(hour &, hour &);
224 friend ostream& operator<<(ostream &, const hour &);
225 friend istream& operator>>(istream &, hour &);
227 String format(const char *fmt = "%T");
244 #endif /* AXE_DATE_H */