# Time Zone (abstract)

Introduction -- Header -- Construction -- Accessors

Introduction

The time_zone_base class is an abstract base class template for representing time zones. Time zones are a set of data and rules that provide information about a time zone. The date_time library handles time_zones by means of a boost::shared_ptr<time_zone_base>. A user's custom time zone class will work in the date_time library by means of this shared_ptr.

For convienience, the time_zone_base class is typedef'd as time_zone. All references in the documentation to time_zone, are referring to this typedef.

Header

The time_zone_base class is defined in the header:

    #include "boost/date_time/time_zone_base.hpp"

Construction

A default constructor is provided in the time_zone_base class. There are no private data members in this base class to initialize.

Template parameters are time_type (typically posix_time::ptime) and CharT (defaults to char).

Accessors

All of the accessors listed here are pure virtual functions.

Syntax | Description
--- | ---

    string_type dst_zone_abbrev();

Returns the daylight savings abbreviation for the represented time zone.

    string_type std_zone_abbrev();

Returns the standard abbreviation for the represented time zone.

    string_type dst_zone_name();

Returns the daylight savings name for the represented time zone.

    string_type std_zone_name();

Returns the standard name for the represented time zone.

    bool has_dst();

Returns true if this time zone does not make a daylight savings shift.

    time_type dst_local_start_time(year_type);

The date and time daylight savings time begins in given year.

    time_type dst_local_end_time(year_type);

The date and time daylight savings time ends in given year.

    time_duration_type base_utc_offset();

The amount of time offset from UTC (typically in hours).

    time_duration_type dst_offset();

The amount of time shifted during daylight savings.

    std::string to_posix_string();

Returns a posix time zone string representation of this time_zone_base object. For a detailed description of a posix time zone string see posix_time_zone.