boost.png (6897 bytes) Home Libraries People FAQ More

PrevUpHomeNext

Class posix_time_zone

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

Synopsis

class posix_time_zone : public boost::local_time::time_zone {
public:
  // types
  typedef boost::posix_time::time_duration                  time_duration_type;
  typedef boost::tokenizer< boost::char_separator< char > > tokenizer;         
  typedef time_zone                                         base_type;         
  typedef base_type::string_type                            string_type;       
  typedef base_type::stringstream_type                      stringstream_type; 

  // construct/copy/destruct
  posix_time_zone(const std::string &);
  ~posix_time_zone();

  // public member functions
  virtual std::string std_zone_abbrev() const;
  virtual std::string dst_zone_abbrev() const;
  virtual std::string std_zone_name() const;
  virtual std::string 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 std::string &) ;
  void calc_rules(const std::string &, const std::string &) ;
  void M_func(const std::string &, const std::string &) ;
  void julian_no_leap(const std::string &, const std::string &) ;
  void julian_day(const std::string &, const std::string &) ;

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

Description

A POSIX time zone string takes the form of:<br> "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:<br> 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:<br> An invalid date spec (see date class) A boost::local_time::bad_offset exception will be thrown for:<br> 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:<br> A DST adjustment that is 24 hours or more (positive or negative)

posix_time_zone construct/copy/destruct

  1. posix_time_zone(const std::string & s);
  2. ~posix_time_zone();

posix_time_zone public member functions

  1. virtual std::string std_zone_abbrev() const;
  2. virtual std::string dst_zone_abbrev() const;

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

  3. virtual std::string 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 std::string 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 private member functions

  1. void calc_zone(const std::string & obj) ;

    Extract time zone abbreviations for STD & DST as well as the offsets for the time the shift 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 std::string & start, const std::string & end) ;
  3. void M_func(const std::string & s, const std::string & e) ;
  4. void julian_no_leap(const std::string & s, const std::string & e) ;
  5. void julian_day(const std::string & s, const std::string & e) ;

posix_time_zone private static functions

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

PrevUpHomeNext