2009-12-12 04:51:53 +00:00
|
|
|
#ifndef __PASCAL_DATE_H__
|
|
|
|
#define __PASCAL_DATE_H__
|
2009-12-10 01:41:37 +00:00
|
|
|
|
|
|
|
#include <ctime>
|
|
|
|
|
|
|
|
namespace Pascal {
|
|
|
|
|
2009-12-12 04:51:53 +00:00
|
|
|
class Date {
|
2009-12-10 01:41:37 +00:00
|
|
|
public:
|
|
|
|
|
2009-12-12 04:51:53 +00:00
|
|
|
static Date Today();
|
|
|
|
|
|
|
|
Date();
|
|
|
|
Date(unsigned yy, unsigned mm, unsigned dd);
|
|
|
|
Date(unsigned);
|
2009-12-10 01:41:37 +00:00
|
|
|
|
|
|
|
operator std::time_t() const;
|
2009-12-12 04:51:53 +00:00
|
|
|
operator unsigned() const;
|
2009-12-10 01:41:37 +00:00
|
|
|
|
|
|
|
unsigned month() const { return _month; }
|
|
|
|
unsigned day() const { return _day; }
|
|
|
|
unsigned year() const { return _year; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
unsigned _year;
|
|
|
|
unsigned _month;
|
|
|
|
unsigned _day;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-12-12 04:51:53 +00:00
|
|
|
inline Date::Date()
|
2009-12-10 01:41:37 +00:00
|
|
|
{
|
|
|
|
_year = 0;
|
|
|
|
_month = 0;
|
|
|
|
_day = 0;
|
|
|
|
}
|
|
|
|
|
2009-12-12 04:51:53 +00:00
|
|
|
inline Date::Date(unsigned yy, unsigned mm, unsigned dd)
|
2009-12-10 01:41:37 +00:00
|
|
|
{
|
|
|
|
_year = yy;
|
|
|
|
_month = mm;
|
|
|
|
_day = dd;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|