Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::local_time::local_date_time_base< utc_time_, tz_type > Class Template Reference

Representation of "wall-clock" time in a particular time zone. More...

#include <local_date_time.hpp>

Inheritance diagram for boost::local_time::local_date_time_base< utc_time_, tz_type >:
Collaboration diagram for boost::local_time::local_date_time_base< utc_time_, tz_type >:

Public Types

enum  DST_CALC_OPTIONS {
  EXCEPTION_ON_ERROR,
  NOT_DATE_TIME_ON_ERROR
}
 
typedef utc_time_ utc_time_type
 
typedef
utc_time_type::time_duration_type 
time_duration_type
 
typedef utc_time_type::date_type date_type
 
typedef date_type::duration_type date_duration_type
 
typedef
utc_time_type::time_system_type 
time_system_type
 
typedef utc_time_ time_type
 
typedef
boost::posix_time::posix_time_system::time_rep_type 
time_rep_type
 

Public Member Functions

 local_date_time_base (utc_time_type t, boost::shared_ptr< tz_type > tz)
 This constructor interprets the passed time as a UTC time. More...
 
 local_date_time_base (date_type d, time_duration_type td, boost::shared_ptr< tz_type > tz, bool dst_flag)
 This constructs a local time – the passed time information understood to be in the passed tz. More...
 
 local_date_time_base (date_type d, time_duration_type td, boost::shared_ptr< tz_type > tz, DST_CALC_OPTIONS calc_option)
 This constructs a local time – the passed time information understood to be in the passed tz. More...
 
 ~local_date_time_base ()
 Simple destructor, releases time zone if last referrer. More...
 
 local_date_time_base (const local_date_time_base &rhs)
 Copy constructor. More...
 
 local_date_time_base (const boost::date_time::special_values sv, boost::shared_ptr< tz_type > tz=boost::shared_ptr< tz_type >())
 Special values constructor. More...
 
boost::shared_ptr< tz_type > zone () const
 returns time zone associated with calling instance More...
 
bool is_dst () const
 returns false is time_zone is NULL and if time value is a special_value More...
 
utc_time_type utc_time () const
 Returns object's time value as a utc representation. More...
 
utc_time_type local_time () const
 Returns object's time value as a local representation. More...
 
std::string to_string () const
 Returns string in the form "2003-Aug-20 05:00:00 EDT". More...
 
local_date_time_base local_time_in (boost::shared_ptr< tz_type > new_tz, time_duration_type td=time_duration_type(0, 0, 0)) const
 returns a local_date_time_base in the given time zone with the optional time_duration added. More...
 
std::string zone_name (bool as_offset=false) const
 Returns name of associated time zone or "Coordinated Universal Time". More...
 
std::string zone_abbrev (bool as_offset=false) const
 Returns abbreviation of associated time zone or "UTC". More...
 
std::string zone_as_posix_string () const
 returns a posix_time_zone string for the associated time_zone. If no time_zone, "UTC+00" is returned. More...
 
bool operator== (const local_date_time_base &rhs) const
 Equality comparison operator. More...
 
bool operator!= (const local_date_time_base &rhs) const
 Non-Equality comparison operator. More...
 
bool operator< (const local_date_time_base &rhs) const
 Less than comparison operator. More...
 
bool operator<= (const local_date_time_base &rhs) const
 Less than or equal to comparison operator. More...
 
bool operator> (const local_date_time_base &rhs) const
 Greater than comparison operator. More...
 
bool operator>= (const local_date_time_base &rhs) const
 Greater than or equal to comparison operator. More...
 
local_date_time_base operator+ (const date_duration_type &dd) const
 Local_date_time + date_duration. More...
 
local_date_time_base operator+= (const date_duration_type &dd)
 Local_date_time += date_duration. More...
 
local_date_time_base operator- (const date_duration_type &dd) const
 Local_date_time - date_duration. More...
 
local_date_time_base operator-= (const date_duration_type &dd)
 Local_date_time -= date_duration. More...
 
local_date_time_base operator+ (const time_duration_type &td) const
 Local_date_time + time_duration. More...
 
local_date_time_base operator+= (const time_duration_type &td)
 Local_date_time += time_duration. More...
 
local_date_time_base operator- (const time_duration_type &td) const
 Local_date_time - time_duration. More...
 
local_date_time_base operator-= (const time_duration_type &td)
 Local_date_time -= time_duration. More...
 
time_duration_type operator- (const local_date_time_base &rhs) const
 local_date_time -= local_date_time –> time_duration_type More...
 
date_type date () const
 
time_duration_type time_of_day () const
 
bool is_not_a_date_time () const
 check to see if date is not a value More...
 
bool is_infinity () const
 check to see if date is one of the infinity values More...
 
bool is_pos_infinity () const
 check to see if date is greater than all possible dates More...
 
bool is_neg_infinity () const
 check to see if date is greater than all possible dates More...
 
bool is_special () const
 check to see if time is a special value More...
 
bool operator== (const time_type &rhs) const
 Equality operator – others generated by boost::equality_comparable. More...
 
bool operator< (const time_type &rhs) const
 Equality operator – others generated by boost::less_than_comparable. More...
 
time_duration_type operator- (const time_type &rhs) const
 difference between two times More...
 
time_type operator- (const date_duration_type &dd) const
 subtract date durations More...
 
time_type operator- (const time_duration_type &rhs) const
 subtract time durations More...
 
time_type operator+ (const date_duration_type &dd) const
 add date durations More...
 
time_type operator+ (const time_duration_type &td) const
 add time durations More...
 
time_type operator+= (const date_duration_type &dd)
 
time_type operator+= (const time_duration_type &td)
 
time_type operator-= (const date_duration_type &dd)
 
time_type operator-= (const time_duration_type &td)
 

Static Public Member Functions

static time_is_dst_result check_dst (date_type d, time_duration_type td, boost::shared_ptr< tz_type > tz)
 Determines if given time label is in daylight savings for given zone. More...
 

Protected Attributes

time_rep_type time_
 

Detailed Description

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
class boost::local_time::local_date_time_base< utc_time_, tz_type >

Representation of "wall-clock" time in a particular time zone.

Representation of "wall-clock" time in a particular time zone Local_date_time_base holds a time value (date and time offset from 00:00) along with a time zone. The time value is stored as UTC and conversions to wall clock time are made as needed. This approach allows for operations between wall-clock times in different time zones, and daylight savings time considerations, to be made. Time zones are required to be in the form of a boost::shared_ptr<time_zone_base>.

Member Typedef Documentation

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
typedef date_type::duration_type boost::local_time::local_date_time_base< utc_time_, tz_type >::date_duration_type
template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
typedef utc_time_type::date_type boost::local_time::local_date_time_base< utc_time_, tz_type >::date_type
template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
typedef utc_time_type::time_duration_type boost::local_time::local_date_time_base< utc_time_, tz_type >::time_duration_type
template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
typedef utc_time_type::time_system_type boost::local_time::local_date_time_base< utc_time_, tz_type >::time_system_type
typedef utc_time_ boost::date_time::base_time< utc_time_ , boost::posix_time::posix_time_system >::time_type
inherited
template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
typedef utc_time_ boost::local_time::local_date_time_base< utc_time_, tz_type >::utc_time_type

Member Enumeration Documentation

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
enum boost::local_time::local_date_time_base::DST_CALC_OPTIONS
Enumerator
EXCEPTION_ON_ERROR 
NOT_DATE_TIME_ON_ERROR 

Constructor & Destructor Documentation

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
boost::local_time::local_date_time_base< utc_time_, tz_type >::local_date_time_base ( utc_time_type  t,
boost::shared_ptr< tz_type >  tz 
)
inline

This constructor interprets the passed time as a UTC time.

So, for example, if the passed timezone is UTC-5 then the time will be adjusted back 5 hours. The time zone allows for automatic calculation of whether the particular time is adjusted for daylight savings, etc. If the time zone shared pointer is null then time stays unadjusted.

Parameters
tA UTC time
tzTimezone for to adjust the UTC time to.

Referenced by boost::local_time::local_date_time_base< utc_time_, tz_type >::local_time_in(), boost::local_time::local_date_time_base< utc_time_, tz_type >::operator+(), and boost::local_time::local_date_time_base< utc_time_, tz_type >::operator-().

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
boost::local_time::local_date_time_base< utc_time_, tz_type >::local_date_time_base ( date_type  d,
time_duration_type  td,
boost::shared_ptr< tz_type >  tz,
bool  dst_flag 
)
inline

This constructs a local time – the passed time information understood to be in the passed tz.

The DST flag must be passed to indicate whether the time is in daylight savings or not.

Exceptions
&ndash;time_label_invalid if the time passed does not exist in the given locale. The non-existent case occurs typically during the shift-back from daylight savings time. When the clock is shifted forward a range of times (2 am to 3 am in the US) is skipped and hence is invalid.
&ndash;dst_not_valid if the DST flag is passed for a period where DST is not active.

References boost::date_time::ambiguous, boost::local_time::local_date_time_base< utc_time_, tz_type >::check_dst(), boost::date_time::invalid_time_label, boost::date_time::is_in_dst, and boost::throw_exception().

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
boost::local_time::local_date_time_base< utc_time_, tz_type >::~local_date_time_base ( )
inline

Simple destructor, releases time zone if last referrer.

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
boost::local_time::local_date_time_base< utc_time_, tz_type >::local_date_time_base ( const local_date_time_base< utc_time_, tz_type > &  rhs)
inline

Copy constructor.

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
boost::local_time::local_date_time_base< utc_time_, tz_type >::local_date_time_base ( const boost::date_time::special_values  sv,
boost::shared_ptr< tz_type >  tz = boost::shared_ptr<tz_type>() 
)
inlineexplicit

Special values constructor.

Member Function Documentation

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
static time_is_dst_result boost::local_time::local_date_time_base< utc_time_, tz_type >::check_dst ( date_type  d,
time_duration_type  td,
boost::shared_ptr< tz_type >  tz 
)
inlinestatic

Determines if given time label is in daylight savings for given zone.

Determines if given time label is in daylight savings for given zone. Takes a date and time_duration representing a local time, along with time zone, and returns a time_is_dst_result object as result.

References boost::date_time::base_time< utc_time_, boost::posix_time::posix_time_system >::date(), boost::date_time::is_not_in_dst, and boost::date_time::base_time< utc_time_, boost::posix_time::posix_time_system >::time_of_day().

Referenced by boost::local_time::local_date_time_base< utc_time_, tz_type >::is_dst(), and boost::local_time::local_date_time_base< utc_time_, tz_type >::local_date_time_base().

bool boost::date_time::base_time< utc_time_ , boost::posix_time::posix_time_system >::is_infinity ( ) const
inlineinherited
bool boost::date_time::base_time< utc_time_ , boost::posix_time::posix_time_system >::is_neg_infinity ( ) const
inlineinherited

check to see if date is greater than all possible dates

References boost::date_time::base_time< T, time_system >::time_.

bool boost::date_time::base_time< utc_time_ , boost::posix_time::posix_time_system >::is_not_a_date_time ( ) const
inlineinherited

check to see if date is not a value

References boost::date_time::base_time< T, time_system >::time_.

bool boost::date_time::base_time< utc_time_ , boost::posix_time::posix_time_system >::is_pos_infinity ( ) const
inlineinherited

check to see if date is greater than all possible dates

References boost::date_time::base_time< T, time_system >::time_.

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
local_date_time_base boost::local_time::local_date_time_base< utc_time_, tz_type >::local_time_in ( boost::shared_ptr< tz_type >  new_tz,
time_duration_type  td = time_duration_type(0,0,0) 
) const
inline
template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
bool boost::local_time::local_date_time_base< utc_time_, tz_type >::operator!= ( const local_date_time_base< utc_time_, tz_type > &  rhs) const
inline

Non-Equality comparison operator.

time_type boost::date_time::base_time< utc_time_ , boost::posix_time::posix_time_system >::operator+ ( const date_duration_type dd) const
inlineinherited
time_type boost::date_time::base_time< utc_time_ , boost::posix_time::posix_time_system >::operator+ ( const time_duration_type td) const
inlineinherited
template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
local_date_time_base boost::local_time::local_date_time_base< utc_time_, tz_type >::operator+ ( const date_duration_type dd) const
inline
template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
local_date_time_base boost::local_time::local_date_time_base< utc_time_, tz_type >::operator+ ( const time_duration_type td) const
inline
template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
local_date_time_base boost::local_time::local_date_time_base< utc_time_, tz_type >::operator+= ( const date_duration_type dd)
inline
template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
local_date_time_base boost::local_time::local_date_time_base< utc_time_, tz_type >::operator+= ( const time_duration_type td)
inline
time_duration_type boost::date_time::base_time< utc_time_ , boost::posix_time::posix_time_system >::operator- ( const time_type rhs) const
inlineinherited

difference between two times

References boost::date_time::base_time< T, time_system >::time_.

time_type boost::date_time::base_time< utc_time_ , boost::posix_time::posix_time_system >::operator- ( const date_duration_type dd) const
inlineinherited

subtract date durations

References boost::date_time::base_time< T, time_system >::time_.

time_type boost::date_time::base_time< utc_time_ , boost::posix_time::posix_time_system >::operator- ( const time_duration_type rhs) const
inlineinherited

subtract time durations

References boost::date_time::base_time< T, time_system >::time_.

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
local_date_time_base boost::local_time::local_date_time_base< utc_time_, tz_type >::operator- ( const date_duration_type dd) const
inline
template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
local_date_time_base boost::local_time::local_date_time_base< utc_time_, tz_type >::operator- ( const time_duration_type td) const
inline
template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
time_duration_type boost::local_time::local_date_time_base< utc_time_, tz_type >::operator- ( const local_date_time_base< utc_time_, tz_type > &  rhs) const
inline
template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
local_date_time_base boost::local_time::local_date_time_base< utc_time_, tz_type >::operator-= ( const date_duration_type dd)
inline
template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
local_date_time_base boost::local_time::local_date_time_base< utc_time_, tz_type >::operator-= ( const time_duration_type td)
inline
bool boost::date_time::base_time< utc_time_ , boost::posix_time::posix_time_system >::operator< ( const time_type rhs) const
inlineinherited

Equality operator – others generated by boost::less_than_comparable.

References boost::date_time::base_time< T, time_system >::time_.

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
bool boost::local_time::local_date_time_base< utc_time_, tz_type >::operator< ( const local_date_time_base< utc_time_, tz_type > &  rhs) const
inline
template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
bool boost::local_time::local_date_time_base< utc_time_, tz_type >::operator<= ( const local_date_time_base< utc_time_, tz_type > &  rhs) const
inline

Less than or equal to comparison operator.

bool boost::date_time::base_time< utc_time_ , boost::posix_time::posix_time_system >::operator== ( const time_type rhs) const
inlineinherited
template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
bool boost::local_time::local_date_time_base< utc_time_, tz_type >::operator== ( const local_date_time_base< utc_time_, tz_type > &  rhs) const
inline
template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
bool boost::local_time::local_date_time_base< utc_time_, tz_type >::operator> ( const local_date_time_base< utc_time_, tz_type > &  rhs) const
inline

Greater than comparison operator.

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
bool boost::local_time::local_date_time_base< utc_time_, tz_type >::operator>= ( const local_date_time_base< utc_time_, tz_type > &  rhs) const
inline

Greater than or equal to comparison operator.

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
std::string boost::local_time::local_date_time_base< utc_time_, tz_type >::to_string ( ) const
inline

Returns string in the form "2003-Aug-20 05:00:00 EDT".

Returns string in the form "2003-Aug-20 05:00:00 EDT". If time_zone is NULL the time zone abbreviation will be "UTC". The time zone abbrev will not be included if calling object is a special_value

References boost::local_time::local_date_time_base< utc_time_, tz_type >::is_dst(), boost::date_time::base_time< utc_time_, boost::posix_time::posix_time_system >::is_special(), boost::local_time::local_date_time_base< utc_time_, tz_type >::local_time(), boost::tuples::detail::lt(), and boost::local_time::local_date_time_base< utc_time_, tz_type >::utc_time().

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
boost::shared_ptr<tz_type> boost::local_time::local_date_time_base< utc_time_, tz_type >::zone ( ) const
inline

returns time zone associated with calling instance

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
std::string boost::local_time::local_date_time_base< utc_time_, tz_type >::zone_abbrev ( bool  as_offset = false) const
inline

Returns abbreviation of associated time zone or "UTC".

Optional bool parameter will return time zone as an offset (ie "+0700" iso format). Empty string is returned for classes that do not use a time_zone

References boost::local_time::local_date_time_base< utc_time_, tz_type >::is_dst().

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
std::string boost::local_time::local_date_time_base< utc_time_, tz_type >::zone_as_posix_string ( ) const
inline

returns a posix_time_zone string for the associated time_zone. If no time_zone, "UTC+00" is returned.

template<class utc_time_ = posix_time::ptime, class tz_type = date_time::time_zone_base<utc_time_,char>>
std::string boost::local_time::local_date_time_base< utc_time_, tz_type >::zone_name ( bool  as_offset = false) const
inline

Returns name of associated time zone or "Coordinated Universal Time".

Optional bool parameter will return time zone as an offset (ie "+07:00" extended iso format). Empty string is returned for classes that do not use a time_zone

References boost::local_time::local_date_time_base< utc_time_, tz_type >::is_dst().

Member Data Documentation


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