|
libdballe
7.7
|
Calendar date. More...
#include <types.h>
Public Member Functions | |
| Date () | |
| Construct a missing date. | |
| Date (int ye, int mo=1, int da=1) | |
| Construct from broken down values. More... | |
| Date (const Date &d)=default | |
| Copy constructor. | |
| bool | is_missing () const |
| Check if this date is the missing value. | |
| int | to_julian () const |
| Convert the date to Julian day. | |
| void | to_stream_iso8601 (std::ostream &out) const |
| Write the date to an output stream in ISO8601 date format. | |
| int | compare (const Date &other) const |
| Generic comparison. More... | |
| bool | operator< (const Date &dt) const |
| bool | operator> (const Date &dt) const |
| bool | operator== (const Date &dt) const |
| bool | operator!= (const Date &dt) const |
Static Public Member Functions | |
| static Date | from_julian (int jday) |
| Create a date from a Julian day. | |
| static void | validate (int ye, int mo, int da) |
| Raise an exception if the three values do not represent a valid date. | |
| static int | days_in_month (int year, int month) |
| Return the number of days in the given month. | |
| static int | calendar_to_julian (int year, int month, int day) |
| Convert a calendar date into a Julian day. | |
| static void | julian_to_calendar (int jday, unsigned short &year, unsigned char &month, unsigned char &day) |
| Convert a Julian day into a calendar date. | |
Data Fields | |
| unsigned short | year |
| unsigned char | month |
| unsigned char | day |
Calendar date.
If year is 0xffff, then all the date is considered missing. Else, all fields must be set.
| dballe::Date::Date | ( | int | ye, |
| int | mo = 1, |
||
| int | da = 1 |
||
| ) |
Construct from broken down values.
A year of MISSING_INT constructs a missing Date. In any other case, arguments are validated with Date::validate().
| int dballe::Date::compare | ( | const Date & | other | ) | const |
Generic comparison.
Returns a negative number if *this < other Returns zero if *this == other Returns a positive number if *this > other
1.8.9.1