#include <temporal.h>
Public Member Functions | |
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 |
virtual bool | is_valid_date () const =0 |
virtual bool | is_valid_datetime () const =0 |
virtual bool | is_valid_time () const =0 |
virtual bool | is_valid_timestamp () const =0 |
virtual bool | is_valid () const =0 |
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 | TemporalFormat |
Base class for all temporal data classes.
Definition at line 92 of file temporal.h.
uint64_t drizzled::Temporal::_cumulative_seconds_in_time | ( | ) | const [protected] |
Returns number of seconds in time components (hour + minute + second)
Definition at line 78 of file temporal.cc.
Referenced by drizzled::Date::operator+(), drizzled::Time::operator+(), drizzled::Date::operator+=(), drizzled::Time::operator+=(), drizzled::Date::operator-(), drizzled::Time::operator-(), drizzled::Date::operator-=(), and drizzled::Time::operator-=().
void drizzled::Temporal::_reset | ( | ) | [inline, protected] |
Resets all temporal components to zero
Definition at line 110 of file temporal.h.
enum calendar drizzled::Temporal::calendar | ( | ) | const [inline] |
Returns the calendar component.
Definition at line 121 of file temporal.h.
uint32_t drizzled::Temporal::days | ( | ) | const [inline] |
Returns the days component.
Definition at line 155 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().
time_t drizzled::Temporal::epoch_seconds | ( | ) | const [inline] |
Returns the UNIX epoch seconds component.
Definition at line 139 of file temporal.h.
uint32_t drizzled::Temporal::hours | ( | ) | const [inline] |
Returns the hours component.
Definition at line 151 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 bool drizzled::Temporal::is_valid | ( | ) | const [pure virtual] |
Returns whether the temporal value is valid. Each subclass defines what is valid for the range of temporal data it contains.
Implemented in drizzled::NanoTimestamp, drizzled::MicroTimestamp, drizzled::Timestamp, drizzled::DateTime, drizzled::Time, and drizzled::Date.
virtual bool drizzled::Temporal::is_valid_date | ( | ) | const [pure virtual] |
Returns whether the temporal value is valid as a date.
Implemented in drizzled::Time, and drizzled::Date.
virtual bool drizzled::Temporal::is_valid_datetime | ( | ) | const [pure virtual] |
Returns whether the temporal value is valid as a datetime.
Implemented in drizzled::Time, and drizzled::Date.
virtual bool drizzled::Temporal::is_valid_time | ( | ) | const [pure virtual] |
Returns whether the temporal value is valid as a time.
Implemented in drizzled::Time, and drizzled::Date.
virtual bool drizzled::Temporal::is_valid_timestamp | ( | ) | const [pure virtual] |
Returns whether the temporal value is valid as a UNIX timestamp.
Implemented in drizzled::Timestamp, drizzled::Time, and drizzled::Date.
uint32_t drizzled::Temporal::minutes | ( | ) | const [inline] |
Returns the minutes component.
Definition at line 147 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().
uint32_t drizzled::Temporal::months | ( | ) | const [inline] |
Returns the months component.
Definition at line 159 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_quarter::val_int(), drizzled::Item_func_month::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().
uint32_t drizzled::Temporal::nseconds | ( | ) | const [inline] |
Returns the nanoseconds component.
Definition at line 125 of file temporal.h.
Referenced by drizzled::Item_func_to_days::val_int_endpoint().
bool drizzled::Temporal::overflow | ( | ) | const [inline] |
Returns whether the overflow flag was set (which can occur during an overloaded operator's execution)
Definition at line 166 of file temporal.h.
References _overflow.
uint32_t drizzled::Temporal::seconds | ( | ) | const [inline] |
Returns the seconds component.
Definition at line 143 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().
void drizzled::Temporal::set_days | ( | const uint32_t | day | ) | [inline] |
Sets the days component.
Definition at line 153 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(), and drizzled::Item_func_unix_timestamp::val_int().
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(), drizzled::Date::from_string(), drizzled::DateTime::from_string(), drizzled::Date::from_tm(), and drizzled::Item_func_unix_timestamp::val_int().
void drizzled::Temporal::set_epoch_seconds | ( | const uint32_t | epoch_second | ) | [inline] |
Sets the epch_seconds component manually.
Definition at line 136 of file temporal.h.
void drizzled::Temporal::set_hours | ( | const uint32_t | hour | ) | [inline] |
Sets the hours component.
Definition at line 149 of file temporal.h.
Referenced by drizzled::Field_datetime::store_time(), and drizzled::Item_func_unix_timestamp::val_int().
void drizzled::Temporal::set_minutes | ( | const uint32_t | minute | ) | [inline] |
Sets the days component.
Definition at line 145 of file temporal.h.
Referenced by drizzled::Field_datetime::store_time(), and drizzled::Item_func_unix_timestamp::val_int().
void drizzled::Temporal::set_months | ( | const uint32_t | month | ) | [inline] |
Sets the months component.
Definition at line 157 of file temporal.h.
Referenced by drizzled::Item_func_curdate::fix_length_and_dec(), drizzled::Field_datetime::store_time(), and drizzled::Item_func_unix_timestamp::val_int().
void drizzled::Temporal::set_nseconds | ( | const uint32_t | nsecond | ) | [inline] |
Sets the nseconds component.
Definition at line 123 of file temporal.h.
void drizzled::Temporal::set_seconds | ( | const uint32_t | second | ) | [inline] |
Sets the seconds component.
Definition at line 141 of file temporal.h.
Referenced by drizzled::Field_datetime::store_time(), and drizzled::Item_func_unix_timestamp::val_int().
void drizzled::Temporal::set_useconds | ( | const uint32_t | usecond | ) | [inline] |
Sets the useconds component.
Definition at line 127 of file temporal.h.
void drizzled::Temporal::set_years | ( | const uint32_t | year | ) | [inline] |
Sets the years component.
Definition at line 161 of file temporal.h.
Referenced by drizzled::Item_func_curdate::fix_length_and_dec(), drizzled::Field_datetime::store_time(), and drizzled::Item_func_unix_timestamp::val_int().
uint32_t drizzled::Temporal::useconds | ( | ) | const [inline] |
Returns the microsseconds component.
Definition at line 129 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().
uint32_t drizzled::Temporal::years | ( | ) | const [inline] |
Returns the years component.
Definition at line 163 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().
friend class TemporalFormat [friend] |
All Temporal derived classes must implement conversion routines for converting to and from a string. Subclasses implement other conversion routines, but should always follow these notes:
1) Ensure that ALL from_xxx methods call is_valid() 2) Ensure that ALL to_xxx methods are void returns and do not call is_valid()
This minimizes the repeated bounds-checking to just the conversion from_xxx routines.
Definition at line 197 of file temporal.h.
bool drizzled::Temporal::_overflow [protected] |
Set on some operator overloads. Indicates that an overflow occurred.
Definition at line 106 of file temporal.h.
Referenced by overflow().