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 time_zone_base

boost::date_time::time_zone_base — Interface class for dynamic time zones.

Synopsis

// In header: <boost/date_time/time_zone_base.hpp>

template<typename time_type, typename CharT> 
class time_zone_base {
public:
  // types
  typedef CharT                             char_type;         
  typedef std::basic_string< CharT >        string_type;       
  typedef std::basic_ostringstream< CharT > stringstream_type; 
  typedef time_type::date_type::year_type   year_type;         
  typedef time_type::time_duration_type     time_duration_type;

  // construct/copy/destruct
  time_zone_base();
  ~time_zone_base();

  // public member functions
  string_type dst_zone_abbrev() const;
  string_type std_zone_abbrev() const;
  string_type dst_zone_name() const;
  string_type std_zone_name() const;
  bool has_dst() const;
  time_type dst_local_start_time(year_type) const;
  time_type dst_local_end_time(year_type) const;
  time_duration_type base_utc_offset() const;
  time_duration_type dst_offset() const;
  string_type to_posix_string() const;
};

Description

This class represents the base interface for all timezone representations. Subclasses may provide different systems for identifying a particular zone. For example some may provide a geographical based zone construction while others may specify the offset from GMT. Another possible implementation would be to convert from POSIX timezone strings. Regardless of the construction technique, this is the interface that these time zone types must provide.

Note that this class is intended to be used as a shared resource (hence the derivation from boost::counted_base.

time_zone_base public construct/copy/destruct

  1. time_zone_base();
  2. ~time_zone_base();

time_zone_base public member functions

  1. string_type dst_zone_abbrev() const;
    String for the timezone when in daylight savings (eg: EDT).
  2. string_type std_zone_abbrev() const;
    String for the zone when not in daylight savings (eg: EST).
  3. string_type dst_zone_name() const;
    String for the timezone when in daylight savings (eg: Eastern Daylight Time).
  4. string_type std_zone_name() const;
    String for the zone when not in daylight savings (eg: Eastern Standard Time).
  5. bool has_dst() const;
    True if zone uses daylight savings adjustments otherwise false.
  6. time_type dst_local_start_time(year_type y) const;
    Local time that DST starts -- undefined if has_dst is false.
  7. time_type dst_local_end_time(year_type y) const;
    Local time that DST ends -- undefined if has_dst is false.
  8. time_duration_type base_utc_offset() const;
    Base offset from UTC for zone (eg: -07:30:00).
  9. time_duration_type dst_offset() const;
    Adjustment forward or back made while DST is in effect.
  10. string_type to_posix_string() const;
    Returns a POSIX time_zone string for this object.

PrevUpHomeNext