#include <temporal.h>
Public Member Functions | |
virtual bool | operator== (const Date &rhs) |
virtual bool | operator!= (const Date &rhs) |
virtual bool | operator> (const Date &rhs) |
virtual bool | operator>= (const Date &rhs) |
virtual bool | operator< (const Date &rhs) |
virtual bool | operator<= (const Date &rhs) |
virtual bool | operator== (const DateTime &rhs) |
virtual bool | operator!= (const DateTime &rhs) |
virtual bool | operator> (const DateTime &rhs) |
virtual bool | operator>= (const DateTime &rhs) |
virtual bool | operator< (const DateTime &rhs) |
virtual bool | operator<= (const DateTime &rhs) |
virtual bool | operator== (const Timestamp &rhs) |
virtual bool | operator!= (const Timestamp &rhs) |
virtual bool | operator> (const Timestamp &rhs) |
virtual bool | operator>= (const Timestamp &rhs) |
virtual bool | operator< (const Timestamp &rhs) |
virtual bool | operator<= (const Timestamp &rhs) |
const Date | operator- (const Date &rhs) |
const Date | operator+ (const Date &rhs) |
Date & | operator+= (const Date &rhs) |
Date & | operator-= (const Date &rhs) |
const Date | operator- (const Time &rhs) |
const Date | operator+ (const Time &rhs) |
Date & | operator-= (const Time &rhs) |
Date & | operator+= (const Time &rhs) |
const Date | operator- (const DateTime &rhs) |
const Date | operator+ (const DateTime &rhs) |
Date & | operator+= (const DateTime &rhs) |
Date & | operator-= (const DateTime &rhs) |
Date & | operator= (const DateTime &rhs) |
virtual bool | is_valid_date () const |
virtual bool | is_valid_datetime () const |
virtual bool | is_valid_time () const |
virtual bool | is_valid_timestamp () const |
virtual bool | is_valid () const |
virtual bool | in_unix_epoch () const |
virtual int | to_string (char *to, size_t to_len) const |
virtual bool | from_string (const char *from, size_t from_len) |
virtual void | to_int64_t (int64_t *to) const |
virtual void | to_int32_t (int32_t *to) const |
virtual bool | from_int32_t (const int32_t from) |
void | to_julian_day_number (int64_t *to) const |
bool | from_julian_day_number (const int64_t from) |
virtual void | to_tm (struct tm *to) const |
virtual bool | from_tm (const struct tm *from) |
virtual void | to_time_t (time_t &to) const |
virtual bool | from_time_t (const time_t from) |
virtual void | to_decimal (type::Decimal *to) const |
enum calendar | calendar () const |
void | set_nseconds (const uint32_t nsecond) |
uint32_t | nseconds () const |
void | set_useconds (const uint32_t usecond) |
uint32_t | useconds () const |
void | set_epoch_seconds () |
void | set_epoch_seconds (const uint32_t epoch_second) |
time_t | epoch_seconds () const |
void | set_seconds (const uint32_t second) |
uint32_t | seconds () const |
void | set_minutes (const uint32_t minute) |
uint32_t | minutes () const |
void | set_hours (const uint32_t hour) |
uint32_t | hours () const |
void | set_days (const uint32_t day) |
uint32_t | days () const |
void | set_months (const uint32_t month) |
uint32_t | months () const |
void | set_years (const uint32_t year) |
uint32_t | years () const |
bool | overflow () const |
Static Public Attributes | |
static const int | MAX_STRING_LENGTH = 11 |
Protected Member Functions | |
uint64_t | _cumulative_seconds_in_time () const |
void | _reset () |
Protected Attributes | |
enum calendar | _calendar |
uint32_t | _years |
uint32_t | _months |
uint32_t | _days |
uint32_t | _hours |
uint32_t | _minutes |
uint32_t | _seconds |
time_t | _epoch_seconds |
uint32_t | _useconds |
uint32_t | _nseconds |
bool | _overflow |
Friends | |
class | TemporalInterval |
class | Timestamp |
Class representing temporal components in a valid SQL date range, with no time component
Definition at line 191 of file temporal.h.
|
protectedinherited |
Returns number of seconds in time components (hour + minute + second)
Definition at line 78 of file temporal.cc.
Referenced by operator+(), drizzled::Time::operator+(), operator+=(), drizzled::Time::operator+=(), operator-(), drizzled::Time::operator-(), operator-=(), and drizzled::Time::operator-=().
|
inlineprotectedinherited |
Resets all temporal components to zero
Definition at line 97 of file temporal.h.
|
inlineinherited |
Returns the calendar component.
Definition at line 108 of file temporal.h.
|
inlineinherited |
Returns the days component.
Definition at line 142 of file temporal.h.
Referenced by drizzled::operator<<(), drizzled::Item_func_curdate_local::store_now_in_TIME(), drizzled::Item_func_curdate_utc::store_now_in_TIME(), drizzled::Item_func_dayofyear::val_int(), drizzled::Item_func_dayofmonth::val_int(), drizzled::Item_func_weekday::val_int(), drizzled::Item_extract::val_int(), and drizzled::Item_func_year::val_int_endpoint().
|
inlineinherited |
Returns the UNIX epoch seconds component.
Definition at line 126 of file temporal.h.
|
virtual |
Attempts to populate the Date instance based on the contents of a supplied 4-byte integer.
Returns whether the conversion was successful.
Integer | to convert from |
Ignore overflow and pass-through to DateTime::from_int64_t()
Reimplemented in drizzled::DateTime.
Definition at line 1121 of file temporal.cc.
bool drizzled::Date::from_julian_day_number | ( | const int64_t | from | ) |
Attempts to populate the Date instance based on the contents of a supplied Julian Day Number
Returns whether the conversion was successful.
Integer | to convert from |
Definition at line 1107 of file temporal.cc.
References drizzled::gregorian_date_from_julian_day_number(), and is_valid().
Referenced by drizzled::Item_func_from_days::get_temporal().
|
virtual |
Attempts to populate the Date instance based on the contents of a supplied string.
Returns whether the conversion was successful.
String | to convert from |
Length | of supplied string (not including trailing '\0'). |
Reimplemented in drizzled::DateTime.
Definition at line 147 of file temporal.cc.
References is_valid(), drizzled::TemporalFormat::matches(), and drizzled::Temporal::set_epoch_seconds().
|
virtual |
Attempts to populate the Date instance based on the contents of a supplied time_t
Returns whether the conversion was successful.
time_t | to convert from |
Reimplemented in drizzled::DateTime.
Definition at line 1248 of file temporal.cc.
References is_valid().
Referenced by drizzled::Item_func_curdate_local::store_now_in_TIME(), and drizzled::Item_func_curdate_utc::store_now_in_TIME().
|
virtual |
Attempts to populate the Date instance based on the contents of a supplied pointer to struct tm (broken time).
Returns whether the conversion was successful.
Pointe | rto the struct tm to convert from |
Definition at line 1204 of file temporal.cc.
References is_valid(), and drizzled::Temporal::set_epoch_seconds().
|
inlineinherited |
Returns the hours component.
Definition at line 138 of file temporal.h.
Referenced by drizzled::operator<<(), drizzled::Item_func_hour::val_int(), drizzled::Item_extract::val_int(), drizzled::Item_func_year::val_int_endpoint(), and drizzled::Item_func_to_days::val_int_endpoint().
|
virtual |
Returns whether the temporal value is valid date.
Implements drizzled::Temporal.
Reimplemented in drizzled::NanoTimestamp, drizzled::MicroTimestamp, drizzled::Timestamp, and drizzled::DateTime.
Definition at line 1353 of file temporal.cc.
References drizzled::days_in_gregorian_year_month().
Referenced by from_julian_day_number(), from_string(), from_time_t(), and from_tm().
|
inlinevirtual |
Returns whether the temporal value is valid as a date.
Implements drizzled::Temporal.
Definition at line 280 of file temporal.h.
|
inlinevirtual |
Returns whether the temporal value is valid as a datetime.
Implements drizzled::Temporal.
Definition at line 281 of file temporal.h.
|
inlinevirtual |
Returns whether the temporal value is valid as a time.
Implements drizzled::Temporal.
Definition at line 282 of file temporal.h.
|
inlinevirtual |
Returns whether the temporal value is valid as a UNIX timestamp.
Implements drizzled::Temporal.
Reimplemented in drizzled::Timestamp.
Definition at line 283 of file temporal.h.
|
inlineinherited |
Returns the minutes component.
Definition at line 134 of file temporal.h.
Referenced by drizzled::operator<<(), drizzled::Item_func_minute::val_int(), drizzled::Item_extract::val_int(), drizzled::Item_func_year::val_int_endpoint(), and drizzled::Item_func_to_days::val_int_endpoint().
|
inlineinherited |
Returns the months component.
Definition at line 146 of file temporal.h.
Referenced by drizzled::Item_func_last_day::get_temporal(), drizzled::operator<<(), drizzled::Item_func_curdate_local::store_now_in_TIME(), drizzled::Item_func_curdate_utc::store_now_in_TIME(), drizzled::Item_func_dayofyear::val_int(), drizzled::Item_func_quarter::val_int(), drizzled::Item_func_month::val_int(), drizzled::Item_func_weekday::val_int(), drizzled::Item_extract::val_int(), and drizzled::Item_func_year::val_int_endpoint().
|
inlineinherited |
Returns the nanoseconds component.
Definition at line 112 of file temporal.h.
Referenced by drizzled::Item_func_to_days::val_int_endpoint().
Need an exception check here for bounds of JDN...
Definition at line 566 of file temporal.cc.
References drizzled::gregorian_date_from_julian_day_number(), and drizzled::julian_day_number_from_gregorian_date().
Need an exception check here for bounds of JDN...
Definition at line 670 of file temporal.cc.
References drizzled::Temporal::_cumulative_seconds_in_time(), drizzled::gregorian_date_from_julian_day_number(), and drizzled::julian_day_number_from_gregorian_date().
Need an exception check here for bounds of JDN...
Definition at line 594 of file temporal.cc.
References drizzled::gregorian_date_from_julian_day_number(), and drizzled::julian_day_number_from_gregorian_date().
Once exceptions are supported, we should raise an error here if the result Time is not valid?
Definition at line 479 of file temporal.cc.
References drizzled::Temporal::_cumulative_seconds_in_time().
Need an exception check here for bounds of JDN...
Definition at line 760 of file temporal.cc.
References drizzled::Temporal::_cumulative_seconds_in_time(), drizzled::gregorian_date_from_julian_day_number(), and drizzled::julian_day_number_from_gregorian_date().
Operator overload for adding/subtracting another Date (or subclass) to/from this temporal. When subtracting or adding two Dates, we return a new Date instance.
Date | instance to add/subtract to/from |
We can add/subtract two Dates to/from each other. The result is always another Date instance.
Definition at line 554 of file temporal.cc.
References drizzled::gregorian_date_from_julian_day_number(), and drizzled::julian_day_number_from_gregorian_date().
Operator to add/subtract a Time from a Time. We can return a Time new temporal instance.
Temporal | instance to add/subtract to/from |
We can add or subtract a Time value to/from a DateTime value as well...it always produces a DateTime.
Definition at line 388 of file temporal.cc.
References drizzled::Temporal::_cumulative_seconds_in_time().
Operator overload for adding/subtracting a DateTime (or subclass) to/from this temporal. When subtracting or adding two Dates, we return a new Date instance.
DateTime | instance to add/subtract to/from |
We can add/subtract two DateTimes to/from each other. The result is always another DateTime instance.
Definition at line 626 of file temporal.cc.
References drizzled::Temporal::_cumulative_seconds_in_time(), drizzled::gregorian_date_from_julian_day_number(), and drizzled::julian_day_number_from_gregorian_date().
Once exceptions are supported, we should raise an error here if the result Time is not valid?
Definition at line 512 of file temporal.cc.
References drizzled::Temporal::_cumulative_seconds_in_time().
|
virtual |
Comparison operator overloads to compare a Date against another Date value.
Date | to compare against. |
Reimplemented in drizzled::Timestamp.
Definition at line 298 of file temporal.cc.
|
virtual |
Comparison operator overloads to compare a Date against a DateTime value.
DateTime | to compare against. |
Reimplemented in drizzled::Timestamp.
Definition at line 336 of file temporal.cc.
|
virtual |
Comparison operator overloads to compare this against a Timestamp value.
Timestamp | to compare against. |
Reimplemented in drizzled::Timestamp.
Definition at line 809 of file temporal.cc.
|
inlineinherited |
Returns whether the overflow flag was set (which can occur during an overloaded operator's execution)
Definition at line 153 of file temporal.h.
|
inlineinherited |
Returns the seconds component.
Definition at line 130 of file temporal.h.
Referenced by drizzled::operator<<(), drizzled::Item_func_second::val_int(), drizzled::Item_extract::val_int(), drizzled::Item_func_year::val_int_endpoint(), and drizzled::Item_func_to_days::val_int_endpoint().
|
inlineinherited |
Sets the days component.
Definition at line 140 of file temporal.h.
Referenced by drizzled::Item_func_curdate::fix_length_and_dec(), drizzled::Item_func_last_day::get_temporal(), drizzled::Field_datetime::store_time(), drizzled::Item_func_unix_timestamp::val_int(), and drizzle_plugin::js::JsFunction::val_str().
|
inherited |
Sets the epoch_seconds component automatically, based on the temporal's components.
Definition at line 123 of file temporal.cc.
References drizzled::in_unix_epoch_range().
Referenced by drizzled::DateTime::from_int64_t(), from_string(), drizzled::DateTime::from_string(), from_tm(), drizzled::Item_func_unix_timestamp::val_int(), and drizzle_plugin::js::JsFunction::val_str().
|
inlineinherited |
Sets the epch_seconds component manually.
Definition at line 123 of file temporal.h.
|
inlineinherited |
Sets the hours component.
Definition at line 136 of file temporal.h.
Referenced by drizzled::Field_datetime::store_time(), drizzled::Item_func_unix_timestamp::val_int(), and drizzle_plugin::js::JsFunction::val_str().
|
inlineinherited |
Sets the days component.
Definition at line 132 of file temporal.h.
Referenced by drizzled::Field_datetime::store_time(), drizzled::Item_func_unix_timestamp::val_int(), and drizzle_plugin::js::JsFunction::val_str().
|
inlineinherited |
Sets the months component.
Definition at line 144 of file temporal.h.
Referenced by drizzled::Item_func_curdate::fix_length_and_dec(), drizzled::Field_datetime::store_time(), drizzled::Item_func_unix_timestamp::val_int(), and drizzle_plugin::js::JsFunction::val_str().
|
inlineinherited |
Sets the nseconds component.
Definition at line 110 of file temporal.h.
|
inlineinherited |
Sets the seconds component.
Definition at line 128 of file temporal.h.
Referenced by drizzled::Field_datetime::store_time(), drizzled::Item_func_unix_timestamp::val_int(), and drizzle_plugin::js::JsFunction::val_str().
|
inlineinherited |
Sets the useconds component.
Definition at line 114 of file temporal.h.
|
inlineinherited |
Sets the years component.
Definition at line 148 of file temporal.h.
Referenced by drizzled::Item_func_curdate::fix_length_and_dec(), drizzled::Field_datetime::store_time(), drizzled::Item_func_unix_timestamp::val_int(), and drizzle_plugin::js::JsFunction::val_str().
|
virtual |
Fills a supplied type::Decimal with a representation of the Date value.
Pointer | to the type::Decimal to fill |
Reimplemented in drizzled::DateTime.
Definition at line 1034 of file temporal.cc.
|
virtual |
Fills a supplied 4-byte integer pointer with an integer representation of the Date value.
Integer | to fill. |
Reimplemented in drizzled::DateTime.
Definition at line 1057 of file temporal.cc.
Referenced by drizzled::Item_date::val_int().
|
virtual |
Fills a supplied 8-byte integer pointer with an integer representation of the Date value.
Integer | to fill. |
Reimplemented in drizzled::DateTime.
Definition at line 1052 of file temporal.cc.
void drizzled::Date::to_julian_day_number | ( | int64_t * | to | ) | const |
Fills a supplied int64_t with the Julian Day Number representation of this Date.
Julian Day Number is the monotonically increasing number of days from the start of the Julian calendar (~4713 B.C.)
julian day is the ordinal day number of a day in a year.
int64_t | to fill |
Definition at line 1113 of file temporal.cc.
References drizzled::julian_day_number_from_gregorian_date().
Referenced by drizzled::Item_func_to_days::val_int(), and drizzled::Item_func_to_days::val_int_endpoint().
|
virtual |
Fills a supplied char string with a string representation of the Date value.
C-String | to fill. |
Length | of to C-String |
Reimplemented in drizzled::MicroTimestamp, and drizzled::DateTime.
Definition at line 994 of file temporal.cc.
Referenced by drizzled::Item_date::val_str().
|
virtual |
Attempts to convert the Date value into a supplied time_t.
Pointer | to a time_t to convert to |
Reimplemented in drizzled::Timestamp.
Definition at line 1324 of file temporal.cc.
|
virtual |
Fills a supplied tm pointer with an representation of the Date value.
tm | to fill. |
Reimplemented in drizzled::DateTime.
Definition at line 1087 of file temporal.cc.
|
inlineinherited |
Returns the microsseconds component.
Definition at line 116 of file temporal.h.
Referenced by drizzled::Item_func_microsecond::val_int(), drizzled::Item_extract::val_int(), drizzled::Item_func_year::val_int_endpoint(), and drizzled::Item_func_to_days::val_int_endpoint().
|
inlineinherited |
Returns the years component.
Definition at line 150 of file temporal.h.
Referenced by drizzled::Item_func_last_day::get_temporal(), drizzled::operator<<(), drizzled::Item_func_curdate_local::store_now_in_TIME(), drizzled::Item_func_curdate_utc::store_now_in_TIME(), drizzled::Item_func_year::val_int(), drizzled::Item_func_dayofyear::val_int(), drizzled::Item_func_weekday::val_int(), drizzled::Item_extract::val_int(), and drizzled::Item_func_year::val_int_endpoint().
|
protectedinherited |
Set on some operator overloads. Indicates that an overflow occurred.
Definition at line 93 of file temporal.h.
|
static |
Maximum length of C-String needed to represent type (including '\0').
Definition at line 310 of file temporal.h.
Referenced by drizzled::Item_func_curdate::fix_length_and_dec().