A time zone class constructed from a POSIX time zone string. More...
#include <posix_time_zone.hpp>
Public Types | |
typedef boost::posix_time::time_duration | time_duration_type |
typedef date_time::time_zone_names_base < CharT > | time_zone_names |
typedef date_time::time_zone_base < posix_time::ptime, CharT > | base_type |
typedef base_type::string_type | string_type |
typedef CharT | char_type |
typedef base_type::stringstream_type | stringstream_type |
typedef boost::char_separator < char_type, std::char_traits < char_type > > | char_separator_type |
typedef boost::tokenizer < char_separator_type, typename string_type::const_iterator, string_type > | tokenizer_type |
typedef tokenizer_type::iterator | tokenizer_iterator_type |
typedef posix_time::ptime::date_type::year_type | year_type |
Public Member Functions | |
posix_time_zone_base (const string_type &s) | |
Construct from a POSIX time zone string. More... | |
virtual | ~posix_time_zone_base () |
virtual string_type | std_zone_abbrev () const |
String for the zone when not in daylight savings (eg: EST) More... | |
virtual string_type | dst_zone_abbrev () const |
String for the timezone when in daylight savings (eg: EDT) More... | |
virtual string_type | std_zone_name () const |
String for the zone when not in daylight savings (eg: Eastern Standard Time) More... | |
virtual string_type | dst_zone_name () const |
String for the timezone when in daylight savings (eg: Eastern Daylight Time) More... | |
virtual bool | has_dst () const |
True if zone uses daylight savings adjustments otherwise false. More... | |
virtual posix_time::ptime | dst_local_start_time (gregorian::greg_year y) const |
Local time that DST starts – NADT if has_dst is false. More... | |
virtual posix_time::ptime | dst_local_end_time (gregorian::greg_year y) const |
Local time that DST ends – NADT if has_dst is false. More... | |
virtual time_duration_type | base_utc_offset () const |
Base offset from UTC for zone (eg: -07:30:00) More... | |
virtual time_duration_type | dst_offset () const |
Adjustment forward or back made while DST is in effect. More... | |
virtual string_type | to_posix_string () const |
Returns a POSIX time_zone string for this object. More... | |
virtual posix_time::ptime | dst_local_start_time (year_type y) const =0 |
Local time that DST starts – undefined if has_dst is false. More... | |
virtual posix_time::ptime | dst_local_end_time (year_type y) const =0 |
Local time that DST ends – undefined if has_dst is false. More... | |
A time zone class constructed from a POSIX time zone string.
A POSIX time zone string takes the form of:
"std offset dst [offset],start[/time],end[/time]" (w/no spaces) 'std' specifies the abbrev of the time zone.
'offset' is the offset from UTC.
'dst' specifies the abbrev of the time zone during daylight savings time.
The second offset is how many hours changed during DST. Default=1
'start' and'end' are the dates when DST goes into (and out of) effect.
'offset' takes the form of: [+|-]hh[:mm[:ss]] {h=0-23, m/s=0-59}
'time' and 'offset' take the same form. Time defaults=02:00:00
'start' and 'end' can be one of three forms:
Mm.w.d {month=1-12, week=1-5 (5 is always last), day=0-6}
Jn {n=1-365 Feb29 is never counted}
n {n=0-365 Feb29 is counted in leap years}
Example "PST-5PDT01:00:00,M4.1.0/02:00:00,M10.1.0/02:00:00"
Exceptions will be thrown under these conditions:
An invalid date spec (see date class)
A boost::local_time::bad_offset exception will be thrown for:
A DST start or end offset that is negative or more than 24 hours
A UTC zone that is greater than +14 or less than -12 hours
A boost::local_time::bad_adjustment exception will be thrown for:
A DST adjustment that is 24 hours or more (positive or negative)
Note that UTC zone offsets can be greater than +12: http://www.worldtimezone.com/utc/utc+1200.html
typedef date_time::time_zone_base<posix_time::ptime,CharT> boost::local_time::posix_time_zone_base< CharT >::base_type |
typedef boost::char_separator<char_type, std::char_traits<char_type> > boost::local_time::posix_time_zone_base< CharT >::char_separator_type |
typedef CharT boost::local_time::posix_time_zone_base< CharT >::char_type |
typedef base_type::string_type boost::local_time::posix_time_zone_base< CharT >::string_type |
typedef base_type::stringstream_type boost::local_time::posix_time_zone_base< CharT >::stringstream_type |
typedef boost::posix_time::time_duration boost::local_time::posix_time_zone_base< CharT >::time_duration_type |
typedef date_time::time_zone_names_base<CharT> boost::local_time::posix_time_zone_base< CharT >::time_zone_names |
typedef tokenizer_type::iterator boost::local_time::posix_time_zone_base< CharT >::tokenizer_iterator_type |
typedef boost::tokenizer<char_separator_type, typename string_type::const_iterator, string_type> boost::local_time::posix_time_zone_base< CharT >::tokenizer_type |
|
inherited |
|
inline |
Construct from a POSIX time zone string.
References boost::tokenizer< TokenizerFunc, Iterator, Type >::begin(), BOOST_THROW_EXCEPTION, boost::end, boost::tokenizer< TokenizerFunc, Iterator, Type >::end(), boost::asio::error::invalid_argument, and boost::it.
|
inlinevirtual |
|
inlinevirtual |
Base offset from UTC for zone (eg: -07:30:00)
Implements boost::date_time::time_zone_base< posix_time::ptime, CharT >.
Referenced by boost::local_time::posix_time_zone_base< CharT >::to_posix_string().
|
pure virtualinherited |
Local time that DST ends – undefined if has_dst is false.
|
inlinevirtual |
Local time that DST ends – NADT if has_dst is false.
References boost::date_time::dst_adjustment_offsets< time_duration_type >::dst_end_offset_, and boost::date_time::not_a_date_time.
|
pure virtualinherited |
Local time that DST starts – undefined if has_dst is false.
|
inlinevirtual |
Local time that DST starts – NADT if has_dst is false.
References boost::date_time::dst_adjustment_offsets< time_duration_type >::dst_start_offset_, and boost::date_time::not_a_date_time.
|
inlinevirtual |
Adjustment forward or back made while DST is in effect.
Implements boost::date_time::time_zone_base< posix_time::ptime, CharT >.
References boost::date_time::dst_adjustment_offsets< time_duration_type >::dst_adjust_.
Referenced by boost::local_time::posix_time_zone_base< CharT >::to_posix_string().
|
inlinevirtual |
String for the timezone when in daylight savings (eg: EDT)
For those time zones that have no DST, an empty string is used
Implements boost::date_time::time_zone_base< posix_time::ptime, CharT >.
References boost::date_time::time_zone_names_base< CharT >::dst_zone_abbrev().
Referenced by boost::local_time::posix_time_zone_base< CharT >::to_posix_string().
|
inlinevirtual |
String for the timezone when in daylight savings (eg: Eastern Daylight Time)
The full DST name is not extracted from the posix time zone string. Therefore, the STD abbreviation is used in it's place. For time zones that have no DST, an empty string is used
Implements boost::date_time::time_zone_base< posix_time::ptime, CharT >.
References boost::date_time::time_zone_names_base< CharT >::dst_zone_name().
|
inlinevirtual |
True if zone uses daylight savings adjustments otherwise false.
Implements boost::date_time::time_zone_base< posix_time::ptime, CharT >.
|
inlinevirtual |
String for the zone when not in daylight savings (eg: EST)
Implements boost::date_time::time_zone_base< posix_time::ptime, CharT >.
References boost::date_time::time_zone_names_base< CharT >::std_zone_abbrev().
Referenced by boost::local_time::posix_time_zone_base< CharT >::to_posix_string().
|
inlinevirtual |
String for the zone when not in daylight savings (eg: Eastern Standard Time)
The full STD name is not extracted from the posix time zone string. Therefore, the STD abbreviation is used in it's place
Implements boost::date_time::time_zone_base< posix_time::ptime, CharT >.
References boost::date_time::time_zone_names_base< CharT >::std_zone_name().
|
inlinevirtual |
Returns a POSIX time_zone string for this object.
Implements boost::date_time::time_zone_base< posix_time::ptime, CharT >.
References boost::local_time::posix_time_zone_base< CharT >::base_utc_offset(), boost::date_time::dst_adjustment_offsets< time_duration_type >::dst_end_offset_, boost::local_time::posix_time_zone_base< CharT >::dst_offset(), boost::date_time::dst_adjustment_offsets< time_duration_type >::dst_start_offset_, boost::local_time::posix_time_zone_base< CharT >::dst_zone_abbrev(), boost::date_time::time_duration< T, rep_type >::hours(), boost::date_time::time_duration< T, rep_type >::invert_sign(), boost::multiprecision::backends::detail::is_negative, boost::date_time::time_duration< T, rep_type >::minutes(), boost::date_time::time_duration< T, rep_type >::seconds(), and boost::local_time::posix_time_zone_base< CharT >::std_zone_abbrev().