Drizzled Public API Documentation

drizzled::MicroTimestamp Class Reference

#include <temporal.h>

Inheritance diagram for drizzled::MicroTimestamp:
drizzled::Timestamp drizzled::DateTime drizzled::Date drizzled::Temporal

List of all members.

Public Member Functions

bool is_valid () const
int to_string (char *to, size_t to_len) const
void to_timeval (struct timeval &to) const
bool operator== (const Date &rhs)
bool operator== (const DateTime &rhs)
bool operator== (const Timestamp &rhs)
bool operator!= (const Date &rhs)
bool operator!= (const DateTime &rhs)
bool operator!= (const Timestamp &rhs)
bool operator> (const Date &rhs)
bool operator> (const DateTime &rhs)
bool operator> (const Timestamp &rhs)
bool operator>= (const Date &rhs)
bool operator>= (const DateTime &rhs)
bool operator>= (const Timestamp &rhs)
bool operator< (const Date &rhs)
bool operator< (const DateTime &rhs)
bool operator< (const Timestamp &rhs)
bool operator<= (const Date &rhs)
bool operator<= (const DateTime &rhs)
bool operator<= (const Timestamp &rhs)
bool is_valid_timestamp () const
void to_time_t (time_t &to) const
bool in_unix_epoch () const
void to_int32_t (int32_t *) const
bool from_int32_t (int32_t)
bool from_string (const char *from, size_t from_len)
void to_int64_t (int64_t *to) const
bool from_time_t (const time_t from)
bool from_timeval (struct timeval &_timeval)
bool from_int64_t (const int64_t from, bool convert)
bool from_int64_t (const int64_t from)
void to_tm (struct tm *to) const
void to_decimal (type::Decimal *to) const
const Date operator- (const Date &rhs)
const Date operator- (const Time &rhs)
const Date operator- (const DateTime &rhs)
const Date operator+ (const Date &rhs)
const Date operator+ (const Time &rhs)
const Date operator+ (const DateTime &rhs)
Dateoperator+= (const Date &rhs)
Dateoperator+= (const Time &rhs)
Dateoperator+= (const DateTime &rhs)
Dateoperator-= (const Date &rhs)
Dateoperator-= (const Time &rhs)
Dateoperator-= (const DateTime &rhs)
virtual bool is_valid_date () const
virtual bool is_valid_datetime () const
virtual bool is_valid_time () const
void to_julian_day_number (int64_t *to) const
bool from_julian_day_number (const int64_t from)
virtual bool from_tm (const struct tm *from)
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 = 27

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 Timestamp
class TemporalInterval
class TemporalFormat

Detailed Description

Class representing temporal components in the UNIX epoch with an additional microsecond component.

Definition at line 767 of file temporal.h.


Member Function Documentation

uint64_t drizzled::Temporal::_cumulative_seconds_in_time ( ) const [protected, inherited]
void drizzled::Temporal::_reset ( ) [inline, protected, inherited]

Resets all temporal components to zero

Definition at line 110 of file temporal.h.

enum calendar drizzled::Temporal::calendar ( ) const [inline, inherited]

Returns the calendar component.

Definition at line 121 of file temporal.h.

time_t drizzled::Temporal::epoch_seconds ( ) const [inline, inherited]

Returns the UNIX epoch seconds component.

Definition at line 139 of file temporal.h.

bool drizzled::DateTime::from_int32_t ( int32_t  from) [inline, virtual, inherited]

Attempts to populate the Date instance based on the contents of a supplied 4-byte integer.

Returns whether the conversion was successful.

Parameters:
Integerto convert from

Ignore overflow and pass-through to DateTime::from_int64_t()

Reimplemented from drizzled::Date.

Definition at line 607 of file temporal.h.

bool drizzled::DateTime::from_int64_t ( const int64_t  from,
bool  convert 
) [inherited]
bool drizzled::Date::from_julian_day_number ( const int64_t  from) [inherited]

Attempts to populate the Date instance based on the contents of a supplied Julian Day Number

Returns whether the conversion was successful.

Parameters:
Integerto convert from

Definition at line 1173 of file temporal.cc.

References drizzled::gregorian_date_from_julian_day_number(), and drizzled::Date::is_valid().

bool drizzled::DateTime::from_time_t ( const time_t  from) [virtual, inherited]

Attempts to populate the DateTime instance based on the contents of a supplied time_t

Returns whether the conversion was successful.

Parameters:
time_tto convert from

Reimplemented from drizzled::Date.

Definition at line 1364 of file temporal.cc.

References drizzled::DateTime::is_valid().

bool drizzled::Date::from_tm ( const struct tm *  from) [virtual, inherited]

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.

Parameters:
Pointerto the struct tm to convert from

Definition at line 1270 of file temporal.cc.

References drizzled::Date::is_valid(), and drizzled::Temporal::set_epoch_seconds().

uint32_t drizzled::Temporal::hours ( ) const [inline, inherited]
bool drizzled::DateTime::in_unix_epoch ( ) const [virtual, inherited]

Returns whether the DateTime (or subclass) instance is in the Unix Epoch.

Reimplemented from drizzled::Date.

Definition at line 1265 of file temporal.cc.

References drizzled::in_unix_epoch_range().

bool drizzled::MicroTimestamp::is_valid ( ) const [virtual]

Returns whether the temporal value is valid micro-timestamp.

Reimplemented from drizzled::Timestamp.

Definition at line 1466 of file temporal.cc.

virtual bool drizzled::Date::is_valid_date ( ) const [inline, virtual, inherited]

Returns whether the temporal value is valid as a date.

Implements drizzled::Temporal.

Definition at line 298 of file temporal.h.

References drizzled::Date::is_valid().

virtual bool drizzled::Date::is_valid_datetime ( ) const [inline, virtual, inherited]

Returns whether the temporal value is valid as a datetime.

Implements drizzled::Temporal.

Definition at line 299 of file temporal.h.

References drizzled::Date::is_valid().

virtual bool drizzled::Date::is_valid_time ( ) const [inline, virtual, inherited]

Returns whether the temporal value is valid as a time.

Implements drizzled::Temporal.

Definition at line 300 of file temporal.h.

bool drizzled::Timestamp::is_valid_timestamp ( ) const [inline, virtual, inherited]

Returns whether the temporal value is valid as a UNIX timestamp.

Reimplemented from drizzled::Date.

Definition at line 745 of file temporal.h.

References drizzled::Timestamp::is_valid().

uint32_t drizzled::Temporal::minutes ( ) const [inline, inherited]
uint32_t drizzled::Temporal::nseconds ( ) const [inline, inherited]

Returns the nanoseconds component.

Definition at line 125 of file temporal.h.

Referenced by drizzled::Item_func_to_days::val_int_endpoint().

const Date drizzled::Date::operator+ ( const Date rhs) [inherited]

Need an exception check here for bounds of JDN...

Definition at line 598 of file temporal.cc.

References drizzled::gregorian_date_from_julian_day_number(), and drizzled::julian_day_number_from_gregorian_date().

const Date drizzled::Date::operator+ ( const DateTime rhs) [inherited]
Date & drizzled::Date::operator+= ( const Date rhs) [inherited]

Need an exception check here for bounds of JDN...

Definition at line 626 of file temporal.cc.

References drizzled::gregorian_date_from_julian_day_number(), and drizzled::julian_day_number_from_gregorian_date().

Date & drizzled::Date::operator+= ( const Time rhs) [inherited]

Once exceptions are supported, we should raise an error here if the result Time is not valid?

Definition at line 511 of file temporal.cc.

References drizzled::Temporal::_cumulative_seconds_in_time().

Date & drizzled::Date::operator+= ( const DateTime rhs) [inherited]
const Date drizzled::Date::operator- ( const Date rhs) [inherited]

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.

Parameters:
Dateinstance 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 586 of file temporal.cc.

References drizzled::gregorian_date_from_julian_day_number(), and drizzled::julian_day_number_from_gregorian_date().

const Date drizzled::Date::operator- ( const DateTime rhs) [inherited]

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.

Parameters:
DateTimeinstance 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 658 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().

const Date drizzled::Date::operator- ( const Time rhs) [inherited]

Operator to add/subtract a Time from a Time. We can return a Time new temporal instance.

Parameters:
Temporalinstance 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 420 of file temporal.cc.

References drizzled::Temporal::_cumulative_seconds_in_time().

Date & drizzled::Date::operator-= ( const Time rhs) [inherited]

Once exceptions are supported, we should raise an error here if the result Time is not valid?

Definition at line 544 of file temporal.cc.

References drizzled::Temporal::_cumulative_seconds_in_time().

bool drizzled::Timestamp::operator== ( const DateTime rhs) [virtual, inherited]

Comparison operator overloads to compare this against a DateTime value.

Parameters:
DateTimeto compare against.

Reimplemented from drizzled::Date.

Definition at line 915 of file temporal.cc.

bool drizzled::Timestamp::operator== ( const Date rhs) [virtual, inherited]

Comparison operator overloads to compare this against a Date value.

Parameters:
Timestampto compare against.

Reimplemented from drizzled::Date.

Definition at line 878 of file temporal.cc.

bool drizzled::Timestamp::operator== ( const Timestamp rhs) [virtual, inherited]

Comparison operator overloads to compare this against another Timestamp value.

Parameters:
Timestampto compare against.

Reimplemented from drizzled::Date.

Definition at line 968 of file temporal.cc.

bool drizzled::Temporal::overflow ( ) const [inline, inherited]

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 drizzled::Temporal::_overflow.

uint32_t drizzled::Temporal::seconds ( ) const [inline, inherited]
void drizzled::Temporal::set_days ( const uint32_t  day) [inline, inherited]
void drizzled::Temporal::set_epoch_seconds ( const uint32_t  epoch_second) [inline, inherited]

Sets the epch_seconds component manually.

Definition at line 136 of file temporal.h.

void drizzled::Temporal::set_epoch_seconds ( ) [inherited]

Sets the epoch_seconds component automatically, based on the temporal's components.

Definition at line 124 of file temporal.cc.

References drizzled::in_unix_epoch_range().

Referenced by drizzled::DateTime::from_int64_t(), drizzled::DateTime::from_string(), drizzled::Date::from_string(), drizzled::Date::from_tm(), and drizzled::Item_func_unix_timestamp::val_int().

void drizzled::Temporal::set_hours ( const uint32_t  hour) [inline, inherited]

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, inherited]

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, inherited]
void drizzled::Temporal::set_nseconds ( const uint32_t  nsecond) [inline, inherited]

Sets the nseconds component.

Definition at line 123 of file temporal.h.

void drizzled::Temporal::set_seconds ( const uint32_t  second) [inline, inherited]

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, inherited]

Sets the useconds component.

Definition at line 127 of file temporal.h.

void drizzled::Temporal::set_years ( const uint32_t  year) [inline, inherited]
void drizzled::DateTime::to_decimal ( type::Decimal to) const [virtual, inherited]

Fills a supplied type::Decimal with a representation of the DateTime value.

Parameters:
Pointerto the type::Decimal to fill

Reimplemented from drizzled::Date.

Definition at line 1098 of file temporal.cc.

void drizzled::DateTime::to_int32_t ( int32_t *  ) const [inline, virtual, inherited]

It's not possible to convert to and from a DateTime and a 4-byte integer, so let us know if we try and do it!

Reimplemented from drizzled::Date.

Definition at line 606 of file temporal.h.

void drizzled::DateTime::to_int64_t ( int64_t *  to) const [virtual, inherited]

Fills a supplied 8-byte integer pointer with an integer representation of the DateTime value.

Parameters:
Integerto fill.

Reimplemented from drizzled::Date.

Definition at line 1139 of file temporal.cc.

Referenced by drizzled::Field_datetime::store_time().

void drizzled::Date::to_julian_day_number ( int64_t *  to) const [inherited]

Fills a supplied int64_t with the Julian Day Number representation of this Date.

Note:
Julian Day Number != julian day!

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.

Parameters:
int64_tto fill

Definition at line 1179 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().

int drizzled::MicroTimestamp::to_string ( char *  to,
size_t  to_len 
) const [virtual]

Fills a supplied char string with a string representation of the MicroTimestamp value.

Parameters:
C-Stringto fill
Lengthof to C-String
Returns:
length of string written (not including trailing '\0'). If output was truncated, returns length that would have been outputted.

Reimplemented from drizzled::DateTime.

Definition at line 1072 of file temporal.cc.

void drizzled::Timestamp::to_time_t ( time_t &  to) const [virtual, inherited]

Attempts to convert the Timestamp value into a supplied time_t.

Parameters:
Pointerto a time_t to convert to

Reimplemented from drizzled::Date.

Definition at line 1402 of file temporal.cc.

Referenced by drizzled::field::Microtime::store(), drizzled::field::Epoch::store(), and drizzled::Item_func_unix_timestamp::val_int().

void drizzled::MicroTimestamp::to_timeval ( struct timeval &  to) const

Fills a supplied timeval pointer with an representation of the MicroTimestamp value.

Returns whether the conversion was successful.

Parameters:
timevalto fill.

Definition at line 1407 of file temporal.cc.

void drizzled::DateTime::to_tm ( struct tm *  to) const [virtual, inherited]

Fills a supplied tm pointer with an representation of the DateTime value.

Parameters:
tmto fill.

Reimplemented from drizzled::Date.

Definition at line 1163 of file temporal.cc.

uint32_t drizzled::Temporal::useconds ( ) const [inline, inherited]

Friends And Related Function Documentation

friend class TemporalFormat [friend, inherited]

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.


Member Data Documentation

bool drizzled::Temporal::_overflow [protected, inherited]

Set on some operator overloads. Indicates that an overflow occurred.

Definition at line 106 of file temporal.h.

Referenced by drizzled::Temporal::overflow().

Maximum length of C-String needed to represent type (including '\0').

Reimplemented from drizzled::DateTime.

Definition at line 791 of file temporal.h.


The documentation for this class was generated from the following files: