Go to the source code of this file.
Classes | |
| struct | PresentWeekYear |
| Struct containing a year and a week of the year. More... | |
| struct | Date |
| Class or struct representing a calendar date. More... | |
Macros | |
| #define | Date_create(...) |
| Create a new Date from either a year (1 argument), a year and a month (2 arguments), or a year/month/day (3 arguments). More... | |
| #define | Date_ptr_create(result,...) |
| Create a new Date from either a year (2 arguments), a year and a month (3 arguments), or a year/month/day (4 arguments). More... | |
Functions | |
| struct Date | Date_from_year (int_year year) |
| Create a new Date based on a year. More... | |
| void | Date_ptr_from_year (struct Date *const result, int_year year) |
| Create a new Date based on a year. More... | |
| struct Date | Date_from_year_month (int_year year, int_month month) |
| Create a new Date based on a year and a month. More... | |
| void | Date_ptr_from_year_month (struct Date *const result, int_year year, int_month month) |
| Create a new Date based on a year and a month. More... | |
| struct Date | Date_from_year_month_day (int_year year, int_month month, int_day day) |
| Create a new Date based on a year, a month, and a day. More... | |
| void | Date_ptr_from_year_month_day (struct Date *const result, int_year year, int_month month, int_day day) |
| Create a new Date based on a year, a month, and a day. More... | |
| struct Date | Date_from_year_day (int_year year, int_day_of_year day_of_year) |
| Create a new Date based on a year and the day of that year. More... | |
| void | Date_ptr_from_year_day (struct Date *const result, int_year year, int_day_of_year day_of_year) |
| Create a new Date based on a year and the day of that year. More... | |
| struct Date | Date_from_year_week_day (int_year year, int_week_of_year week_of_year, int_day_of_week day_of_week) |
| Create a new Date based on a year, a week of that year, and a day of the week. More... | |
| void | Date_ptr_from_year_week_day (struct Date *const result, int_year year, int_week_of_year week_of_year, int_day_of_week day_of_week) |
| Create a new Date based on a year, a week of that year, and a day of the week. More... | |
| int_year | Date_year (const struct Date *const self) |
| Get the year of a Date. More... | |
| int_month | Date_month (const struct Date *const self) |
| Get the month of a Date (1 to 12, inclusive). More... | |
| int_day | Date_day (const struct Date *const self) |
| Get the day of month of a Date (1 to 31, inclusive). More... | |
| int_day_of_year | Date_day_of_year (const struct Date *const self) |
| Get the day of the year of a Date (1 to 366, inclusive). More... | |
| struct PresentWeekYear | Date_week_of_year (const struct Date *const self) |
| Get the week of the year of a Date (1 to 53, inclusive), and the year corresponding to that week. More... | |
| int_day_of_week | Date_day_of_week (const struct Date *const self) |
| Get the day of the week of a Date (1 to 7, inclusive, with 1 being Monday, 2 being Tuesday, ..., 6 being Saturday, and 7 being Sunday). More... | |
| struct DayDelta | Date_difference (const struct Date *const self, const struct Date *const other) |
| Get the difference between two Date instances. More... | |
| struct DayDelta | Date_absolute_difference (const struct Date *const self, const struct Date *const other) |
| Get the absolute difference between two Date instances. More... | |
| void | Date_add_DayDelta (struct Date *const self, const struct DayDelta *const delta) |
| Add a DayDelta to a Date. More... | |
| void | Date_add_MonthDelta (struct Date *const self, const struct MonthDelta *const delta) |
| Add a MonthDelta to a Date. More... | |
| void | Date_subtract_DayDelta (struct Date *const self, const struct DayDelta *const delta) |
| Subtract a DayDelta from a Date. More... | |
| void | Date_subtract_MonthDelta (struct Date *const self, const struct MonthDelta *const delta) |
| Subtract a MonthDelta from a Date. More... | |
| short | Date_compare (const struct Date *const lhs, const struct Date *const rhs) |
| Compare two Date instances. More... | |
| present_bool | Date_equal (const struct Date *const lhs, const struct Date *const rhs) |
| Determine whether two Date instances are equal (lhs == rhs). More... | |
| present_bool | Date_less_than (const struct Date *const lhs, const struct Date *const rhs) |
| Determine whether a Date is earlier than another Date (lhs < rhs). More... | |
| present_bool | Date_less_than_or_equal (const struct Date *const lhs, const struct Date *const rhs) |
| Determine whether a Date is earlier than or the same as another Date (lhs <= rhs). More... | |
| present_bool | Date_greater_than (const struct Date *const lhs, const struct Date *const rhs) |
| Determine whether a Date is later than another Date (lhs > rhs). More... | |
| present_bool | Date_greater_than_or_equal (const struct Date *const lhs, const struct Date *const rhs) |
| Determine whether a Date is later than or the same as another Date (lhs >= rhs). More... | |
| #define Date_create | ( | ... | ) |
Create a new Date from either a year (1 argument), a year and a month (2 arguments), or a year/month/day (3 arguments).
has_error field on the returned struct is true.If has_error is true, then at least one of the fields in the errors struct will also be true.
| #define Date_ptr_create | ( | result, | |
| ... | |||
| ) |
Create a new Date from either a year (2 arguments), a year and a month (3 arguments), or a year/month/day (4 arguments).
The first argumen is a pointer to a struct Date for the result.
has_error field on the returned struct is true.If has_error is true, then at least one of the fields in the errors struct will also be true.
Create a new Date based on a year.
The month and day will be set to January 1.
| year | The year. |
Create a new Date based on a year and a month.
The day will be set to the first of the month.
If the month is out of range, the Date will have has_error and errors set.
has_error field on the returned struct is true.If has_error is true, then at least one of the fields in the errors struct will also be true.
| year | The year. |
| month | The month of the year (1 to 12, inclusive). |
Create a new Date based on a year and a month.
The day will be set to the first of the month.
If the month is out of range, the Date will have has_error and errors set.
has_error field on the returned struct is true.If has_error is true, then at least one of the fields in the errors struct will also be true.
| year | The year. | |
| month | The month of the year (1 to 12, inclusive). | |
| [out] | result | A pointer to a struct Date for the result. |
Create a new Date based on a year, a month, and a day.
If the month or the day is out of range, the Date will have has_error and errors set.
has_error field on the returned struct is true.If has_error is true, then at least one of the fields in the errors struct will also be true.
| year | The year. |
| month | The month of the year (1 to 12, inclusive). |
| day | The day of the month (1 to either 28, 29, 30, or 31, inclusive, depending on the month). |
| void Date_ptr_from_year_month_day | ( | struct Date *const | result, |
| int_year | year, | ||
| int_month | month, | ||
| int_day | day | ||
| ) |
Create a new Date based on a year, a month, and a day.
If the month or the day is out of range, the Date will have has_error and errors set.
has_error field on the returned struct is true.If has_error is true, then at least one of the fields in the errors struct will also be true.
| year | The year. | |
| month | The month of the year (1 to 12, inclusive). | |
| day | The day of the month (1 to either 28, 29, 30, or 31, inclusive, depending on the month). | |
| [out] | result | A pointer to a struct Date for the result. |
| struct Date Date_from_year_day | ( | int_year | year, |
| int_day_of_year | day_of_year | ||
| ) |
Create a new Date based on a year and the day of that year.
| year | The year. |
| day_of_year | The day of the year. |
| void Date_ptr_from_year_day | ( | struct Date *const | result, |
| int_year | year, | ||
| int_day_of_year | day_of_year | ||
| ) |
| struct Date Date_from_year_week_day | ( | int_year | year, |
| int_week_of_year | week_of_year, | ||
| int_day_of_week | day_of_week | ||
| ) |
Create a new Date based on a year, a week of that year, and a day of the week.
Weeks of the year are determined in the same way that the ISO8601 standard defines week numbers. For more info, see: https://en.wikipedia.org/wiki/ISO_week_date
If the week of the year or the day of the week is out of range, the Date will have has_error and errors set.
has_error field on the returned struct is true.If has_error is true, then at least one of the fields in the errors struct will also be true.
| year | The year. |
| week_of_year | The week of the year (1 to 52 or 53, inclusive, depending on the year). |
| day_of_week | The day of the week (1 to 7, inclusive). See present/internal/types.h for constants for each day of the week. |
| void Date_ptr_from_year_week_day | ( | struct Date *const | result, |
| int_year | year, | ||
| int_week_of_year | week_of_year, | ||
| int_day_of_week | day_of_week | ||
| ) |
Create a new Date based on a year, a week of that year, and a day of the week.
Weeks of the year are determined in the same way that the ISO8601 standard defines week numbers. For more info, see: https://en.wikipedia.org/wiki/ISO_week_date
If the week of the year or the day of the week is out of range, the Date will have has_error and errors set.
has_error field on the returned struct is true.If has_error is true, then at least one of the fields in the errors struct will also be true.
| year | The year. | |
| week_of_year | The week of the year (1 to 52 or 53, inclusive, depending on the year). | |
| day_of_week | The day of the week (1 to 7, inclusive). See present/internal/types.h for constants for each day of the week. | |
| [out] | result | A pointer to a struct Date for the result. |
Get the day of month of a Date (1 to 31, inclusive).
| int_day_of_year Date_day_of_year | ( | const struct Date *const | self | ) |
Get the day of the year of a Date (1 to 366, inclusive).
| struct PresentWeekYear Date_week_of_year | ( | const struct Date *const | self | ) |
Get the week of the year of a Date (1 to 53, inclusive), and the year corresponding to that week.
| int_day_of_week Date_day_of_week | ( | const struct Date *const | self | ) |
Get the day of the week of a Date (1 to 7, inclusive, with 1 being Monday, 2 being Tuesday, ..., 6 being Saturday, and 7 being Sunday).
Get the difference between two Date instances.
| struct DayDelta Date_absolute_difference | ( | const struct Date *const | self, |
| const struct Date *const | other | ||
| ) |
Get the absolute difference between two Date instances.
| void Date_add_MonthDelta | ( | struct Date *const | self, |
| const struct MonthDelta *const | delta | ||
| ) |
Add a MonthDelta to a Date.
| void Date_subtract_MonthDelta | ( | struct Date *const | self, |
| const struct MonthDelta *const | delta | ||
| ) |
Subtract a MonthDelta from a Date.
Compare two Date instances.
| present_bool Date_equal | ( | const struct Date *const | lhs, |
| const struct Date *const | rhs | ||
| ) |
Determine whether two Date instances are equal (lhs == rhs).
| present_bool Date_less_than | ( | const struct Date *const | lhs, |
| const struct Date *const | rhs | ||
| ) |
| present_bool Date_less_than_or_equal | ( | const struct Date *const | lhs, |
| const struct Date *const | rhs | ||
| ) |
| present_bool Date_greater_than | ( | const struct Date *const | lhs, |
| const struct Date *const | rhs | ||
| ) |
| present_bool Date_greater_than_or_equal | ( | const struct Date *const | lhs, |
| const struct Date *const | rhs | ||
| ) |