# Local Time

Local Time System

Introduction -- Usage Examples

Introduction

The library supports 4 main extensions for the management of local times. This includes

- local_date_time -- locally adjusted time point
- posix_time_zone -- time zone defined by posix string (eg: "EST10EDT,M10.5.0,M3.5.0/03")
- time_zone_database -- get time zones by region from .csv file (eg: America/New York)
- time_zone -- abstract time zone interface

Together, these extensions define a time system adjusted for recording times related to a specific earth location. This time system utilizes all the features and benefits of the posix_time system (see posix_time for full details). It uses a time_zone object which contains all the necessary data/rules to enable adjustments to and from various time zones. The time_zone objects used in date_time are handled via a boost::shared_ptr<boost::local_time::time_zone>.

The phrase "wall-clock" refers to the time that would be shown on a wall clock in a particular time zone at any point in time. Local_time uses a time zone object to account for differences in time zones and daylight savings adjustments. For example: While 5:00 pm, October 10, 2004 in Sydney Australia occurs at exactly the same instant as 3:00 am, October 10, 2004 in New York USA, it is a 14 hour difference in wall-clock times. However, a point in time just one day later will result in a 16 hour difference in wall-clock time due to daylight savings adjustments in both time zones. The local_time system tracks these by means of a time point, stored as UTC, and time_zone objects that contain all the necessary data to correctly calculate wall-clock times.

Usage Examples

Example | Description
--- | ---
Simple Time Zone | Side by side examples of Time Zone usage. Both custom_time_zone and posix_time_zone are shown.
Daylight Savings Calc Rules | Simple example showing the creation of all five dst_calc_rule types.
Seconds Since Epoch | Example that calculates the total seconds elapsed since the epoch (1970-Jan-01) utilizing local_date_time.