![]() |
Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
|
The Date class is a static class that holds helper functions for the Date type. More...
#include <duckdb.hpp>

Static Public Member Functions | |
| static DUCKDB_API date_t | FromString (const string &str, bool strict=false) |
| Convert a string in the format "YYYY-MM-DD" to a date object. | |
| static DUCKDB_API date_t | FromCString (const char *str, idx_t len, bool strict=false) |
| Convert a string in the format "YYYY-MM-DD" to a date object. | |
| static DUCKDB_API string | ToString (date_t date) |
| Convert a date object to a string in the format "YYYY-MM-DD". | |
| static DUCKDB_API bool | TryConvertDateSpecial (const char *buf, idx_t len, idx_t &pos, const DateSpecial &special) |
| static DUCKDB_API DateCastResult | TryConvertDate (const char *buf, idx_t len, idx_t &pos, date_t &result, bool &special, bool strict=false) |
| static DUCKDB_API string | Format (int32_t year, int32_t month, int32_t day) |
| static DUCKDB_API void | Convert (date_t date, int32_t &out_year, int32_t &out_month, int32_t &out_day) |
| Extract the year, month and day from a given date object. | |
| static DUCKDB_API date_t | FromDate (int32_t year, int32_t month, int32_t day) |
| Create a Date object from a specified (year, month, day) combination. | |
| static DUCKDB_API bool | TryFromDate (int32_t year, int32_t month, int32_t day, date_t &result) |
| static DUCKDB_API bool | IsLeapYear (int32_t year) |
| Returns true if (year) is a leap year, and false otherwise. | |
| static DUCKDB_API bool | IsValid (int32_t year, int32_t month, int32_t day) |
| static bool | IsFinite (date_t date) |
| Returns true if the specified date is finite. | |
| static DUCKDB_API int32_t | MonthDays (int32_t year, int32_t month) |
| The max number of days in a month of a given year. | |
| static DUCKDB_API int64_t | Epoch (date_t date) |
| Extract the epoch from the date (seconds since 1970-01-01). | |
| static DUCKDB_API int64_t | EpochNanoseconds (date_t date) |
| Extract the epoch from the date (nanoseconds since 1970-01-01). | |
| static DUCKDB_API int64_t | EpochMicroseconds (date_t date) |
| Extract the epoch from the date (microseconds since 1970-01-01). | |
| static DUCKDB_API int64_t | EpochMilliseconds (date_t date) |
| Extract the epoch from the date (milliseconds since 1970-01-01). | |
| static DUCKDB_API date_t | EpochToDate (int64_t epoch) |
| Convert the epoch (seconds since 1970-01-01) to a date_t. | |
| static DUCKDB_API int32_t | EpochDays (date_t date) |
| Extract the number of days since epoch (days since 1970-01-01). | |
| static DUCKDB_API date_t | EpochDaysToDate (int32_t epoch) |
| Convert the epoch number of days to a date_t. | |
| static DUCKDB_API int32_t | ExtractYear (date_t date) |
| Extract year of a date entry. | |
| static DUCKDB_API int32_t | ExtractMonth (date_t date) |
| Extract month of a date entry. | |
| static DUCKDB_API int32_t | ExtractDay (date_t date) |
| Extract day of a date entry. | |
| static DUCKDB_API int32_t | ExtractISODayOfTheWeek (date_t date) |
| Extract the day of the week (1-7). | |
| static DUCKDB_API int32_t | ExtractDayOfTheYear (date_t date) |
| Extract the day of the year. | |
| static DUCKDB_API int64_t | ExtractJulianDay (date_t date) |
| Extract the day of the year. | |
| static DUCKDB_API void | ExtractISOYearWeek (date_t date, int32_t &year, int32_t &week) |
| static DUCKDB_API int32_t | ExtractISOWeekNumber (date_t date) |
| static DUCKDB_API int32_t | ExtractISOYearNumber (date_t date) |
| static DUCKDB_API int32_t | ExtractWeekNumberRegular (date_t date, bool monday_first=true) |
| static DUCKDB_API date_t | GetMondayOfCurrentWeek (date_t date) |
| Returns the date of the monday of the current week. | |
| static DUCKDB_API bool | ParseDoubleDigit (const char *buf, idx_t len, idx_t &pos, int32_t &result) |
| Helper function to parse two digits from a string (e.g. "30" -> 30, "03" -> 3, "3" -> 3). | |
| static DUCKDB_API string | FormatError (const string &str) |
| static DUCKDB_API string | FormatError (string_t str) |
| static DUCKDB_API string | RangeError (const string &str) |
| static DUCKDB_API string | RangeError (string_t str) |
Static Public Attributes | |
| static const DateSpecial | PINF = {"infinity", 3} |
| static const DateSpecial | NINF = {"-infinity", 4} |
| static const DateSpecial | EPOCH = {"epoch", 5} |
| static const string_t | MONTH_NAMES [12] |
| static const string_t | MONTH_NAMES_ABBREVIATED [12] |
| static const string_t | DAY_NAMES [7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"} |
| static const string_t | DAY_NAMES_ABBREVIATED [7] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"} |
| static const int32_t | NORMAL_DAYS [13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} |
| static const int32_t | CUMULATIVE_DAYS [13] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365} |
| static const int32_t | LEAP_DAYS [13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} |
| static const int32_t | CUMULATIVE_LEAP_DAYS [13] = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} |
| static const int32_t | CUMULATIVE_YEAR_DAYS [401] |
| static const int8_t | MONTH_PER_DAY_OF_YEAR [365] |
| static const int8_t | LEAP_MONTH_PER_DAY_OF_YEAR [366] |
| static constexpr const int32_t | DATE_MIN_YEAR = -5877641 |
| static constexpr const int32_t | DATE_MIN_MONTH = 6 |
| static constexpr const int32_t | DATE_MIN_DAY = 25 |
| static constexpr const int32_t | DATE_MAX_YEAR = 5881580 |
| static constexpr const int32_t | DATE_MAX_MONTH = 7 |
| static constexpr const int32_t | DATE_MAX_DAY = 10 |
| static constexpr const int32_t | EPOCH_YEAR = 1970 |
| static constexpr const int32_t | YEAR_INTERVAL = 400 |
| static constexpr const int32_t | DAYS_PER_YEAR_INTERVAL = 146097 |
Static Private Member Functions | |
| static void | ExtractYearOffset (int32_t &n, int32_t &year, int32_t &year_offset) |
|
static |
Convert a string in the format "YYYY-MM-DD" to a date object.

Convert a string in the format "YYYY-MM-DD" to a date object.


|
static |
Convert a date object to a string in the format "YYYY-MM-DD".


|
static |
Try to convert the string as a give "special" date (e.g, PINF, ...) Returns true if it was successful and updates the scan pos.

|
static |
Try to convert text in a buffer to a date; returns true if parsing was successful If the date was a "special" value, the special flag will be set.


Create a string "YYYY-MM-DD" from a specified (year, month, day) combination

|
static |
Extract the year, month and day from a given date object.

Create a Date object from a specified (year, month, day) combination.

|
static |
Returns true if (year) is a leap year, and false otherwise.

Returns true if the specified (year, month, day) combination is a valid date

|
inlinestatic |
Returns true if the specified date is finite.

The max number of days in a month of a given year.


Extract the epoch from the date (seconds since 1970-01-01).
Extract the epoch from the date (nanoseconds since 1970-01-01).

Extract the epoch from the date (microseconds since 1970-01-01).

Extract the epoch from the date (milliseconds since 1970-01-01).

Convert the epoch (seconds since 1970-01-01) to a date_t.
Extract the number of days since epoch (days since 1970-01-01).
Convert the epoch number of days to a date_t.
Extract year of a date entry.
Extract month of a date entry.

Extract day of a date entry.

Extract the day of the week (1-7).

Extract the day of the year.
Extract the day of the year.

Extract the ISO week number ISO weeks start on Monday and the first week of a year contains January 4 of that year. In the ISO week-numbering system, it is possible for early-January dates to be part of the 52nd or 53rd week of the previous year.
Extract the week number as Python handles it. Either Monday or Sunday is the first day of the week, and any date before the first Monday/Sunday returns week 0 This is a bit more consistent because week numbers in a year are always incrementing

Returns the date of the monday of the current week.

|
static |
Helper function to parse two digits from a string (e.g. "30" -> 30, "03" -> 3, "3" -> 3).

|
static |
|
static |
|
static |
|
static |
|
staticprivate |
|
static |
|
static |
|
static |
|
static |
|
static |