NAME

DateTime::TimeZone::Olson - timezones from the Olson database

SYNOPSIS

use DateTime::TimeZone::Olson qw(olson_version);

$version = olson_version;

use DateTime::TimeZone::Olson qw(
	olson_canonical_names olson_link_names olson_all_names
	olson_links
	olson_country_selection
);

$names = olson_canonical_names;
$names = olson_link_names;
$names = olson_all_names;
$links = olson_links;
$countries = olson_country_selection;

use DateTime::TimeZone::Olson qw(olson_tz);

$tz = olson_tz("America/New_York");

DESCRIPTION

This module encapsulates the Olson timezone database, providing DateTime-compatible timezone objects and ancillary data. On each program run this module provides access to a particular version of the timezone database, determined by which version of Time::OlsonTZ::Data is installed.

FUNCTIONS

Basic information

olson_version

Returns the version number of the database to which this module is providing access. Version numbers for the Olson database currently consist of a year number and a lowercase letter, such as "2010k"; they are not guaranteed to retain this format in the future.

Zone metadata

olson_canonical_names

Returns the set of timezone names that this version of the database defines as canonical. These are the timezone names that are directly associated with a set of observance data. The return value is a reference to a hash, in which the keys are the canonical timezone names and the values are all undef.

Returns the set of timezone names that this version of the database defines as links. These are the timezone names that are aliases for other names. The return value is a reference to a hash, in which the keys are the link timezone names and the values are all undef.

olson_all_names

Returns the set of timezone names that this version of the database defines. These are the "olson_canonical_names" and the "olson_link_names". The return value is a reference to a hash, in which the keys are the timezone names and the values are all undef.

Returns details of the timezone name links in this version of the database. Each link defines one timezone name as an alias for some other timezone name. The return value is a reference to a hash, in which the keys are the aliases and each value is the canonical name of the timezone to which that alias refers. All such canonical names can be found in the "olson_canonical_names" hash.

olson_country_selection

Returns information about how timezones relate to countries, intended to aid humans in selecting a geographical timezone. For details of the data format see "olson_country_selection" in Time::OlsonTZ::Data.

Zone data

olson_tz(NAME)

Returns a reference to an object that encapsulates the timezone named NAME in the Olson database and which implements the DateTime::TimeZone interface. dies if the name does not exist in this version of the database. Currently the object is of class DateTime::TimeZone::Tzfile, but this is not guaranteed.

BUGS

Parts of the Olson timezone database are liable to be inaccurate. See "BUGS" in Time::OlsonTZ::Data for discussion. Frequent updates of the installation of Time::OlsonTZ::Data is recommended, to keep it accurate for current dates.

SEE ALSO

DateTime::TimeZone, DateTime::TimeZone::Tzfile, Time::OlsonTZ::Data

AUTHOR

Andrew Main (Zefram) <zefram@fysh.org>

COPYRIGHT

Copyright (C) 2010 Andrew Main (Zefram) <zefram@fysh.org>

LICENSE

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.