Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Class template posix_time_zone_base

boost::local_time::posix_time_zone_base — A time zone class constructed from a POSIX time zone string.

Synopsis

template<typename CharT> 
class posix_time_zone_base {
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 boost::tokenizer< char_separator_type, typename string_type::const_iterator, string_type >::iterator tokenizer_iterator_type;

  // construct/copy/destruct
  posix_time_zone_base(const string_type &);
  ~posix_time_zone_base();

  // public member functions
  virtual string_type std_zone_abbrev() const;
  virtual string_type dst_zone_abbrev() const;
  virtual string_type std_zone_name() const;
  virtual string_type dst_zone_name() const;
  virtual bool has_dst() const;
  virtual posix_time::ptime dst_local_start_time(gregorian::greg_year) const;
  virtual posix_time::ptime dst_local_end_time(gregorian::greg_year) const;
  virtual time_duration_type base_utc_offset() const;
  virtual time_duration_type dst_offset() const;
  virtual string_type to_posix_string() const;

  // private member functions
  void calc_zone(const string_type &) ;
  void calc_rules(const string_type &, const string_type &) ;
  void M_func(const string_type &, const string_type &) ;
  void julian_no_leap(const string_type &, const string_type &) ;
  void julian_day(const string_type &, const string_type &) ;

  // private static functions
  static std::string td_as_string(const time_duration_type &) ;
};

Description

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 +12 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)

posix_time_zone_base construct/copy/destruct

  1. posix_time_zone_base(const string_type & s);
  2. ~posix_time_zone_base();

posix_time_zone_base public member functions

  1. virtual string_type std_zone_abbrev() const;
  2. virtual string_type dst_zone_abbrev() const;

    For those time zones that have no DST, an empty string is used

  3. virtual string_type std_zone_name() const;

    The full STD name is not extracted from the posix time zone string. Therefore, the STD abbreviation is used in it's place

  4. virtual string_type dst_zone_name() const;

    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

  5. virtual bool has_dst() const;
  6. virtual posix_time::ptime dst_local_start_time(gregorian::greg_year y) const;
  7. virtual posix_time::ptime dst_local_end_time(gregorian::greg_year y) const;
  8. virtual time_duration_type base_utc_offset() const;
  9. virtual time_duration_type dst_offset() const;
  10. virtual string_type to_posix_string() const;

posix_time_zone_base private member functions

  1. void calc_zone(const string_type & obj) ;

    Extract time zone abbreviations for STD & DST as well as the offsets for the time shift that occurs and how much of a shift. At this time full time zone names are NOT extracted so the abbreviations are used in their place

  2. void calc_rules(const string_type & start, const string_type & end) ;
  3. void M_func(const string_type & s, const string_type & e) ;
  4. void julian_no_leap(const string_type & s, const string_type & e) ;
  5. void julian_day(const string_type & s, const string_type & e) ;

posix_time_zone_base private static functions

  1. static std::string td_as_string(const time_duration_type & td) ;
Copyright © 2001-2005 CrystalClear Software, Inc

PrevUpHomeNext