NAME
Time::Keeper::Zone - the time zones of the IANA database, compiled in
VERSION
Version 0.01
SYNOPSIS
use Time::Keeper::Zone;
my @zones = Time::Keeper::Zone->names;
my %links = Time::Keeper::Zone->links;
Time::Keeper::Zone->is_valid('europe/london'); # true
Time::Keeper::Zone->name('europe/london'); # Europe/London
Time::Keeper::Zone->canonical_name('US/Eastern'); # America/New_York
Time::Keeper::Zone->local_name; # this machine's zone
Time::Keeper::Zone->tzdata_version; # 2026e
my %countries = Time::Keeper::Zone->countries;
my @zones_gb = Time::Keeper::Zone->zones_for_country('GB');
Time::Keeper::Zone->windows_zone('GMT Standard Time'); # Europe/London
DESCRIPTION
Time::Keeper::Zone holds the time zones that Time::Keeper uses. It is a dist of its own so that a new release of the IANA time zone database is a new release of this dist alone, and Time::Keeper itself does not change.
The zone data is compiled into the module. The system's own zone files are never read, so every machine gives the same answer for the same version of this dist.
Time::Keeper loads this module the first time a named zone is asked for. A program that works only in UTC or in fixed offsets never loads it.
A zone here is a name, not an object. Times in a zone are asked of Time::Keeper; this module answers questions about the zones themselves. Every method is a class method.
Names are matched without regard to case: europe/london is Europe/London. A link is an older or alternative name for a zone, such as US/Eastern for America/New_York; it follows that zone's rules exactly, and keeps its own name.
METHODS
names
Every zone's name, in order. Links are not included: see "links".
links
Every link, as a list of pairs: the link's name, then the name of the zone it follows. Assign it to a hash.
is_valid($name)
True if $name is a zone or a link, in any case.
name($name)
$name as the database spells it, or undef if it is not a zone or link. A link gives back its own name.
canonical_name($name)
The zone $name follows: the zone itself, or for a link the zone it leads to. Undef if it is neither.
local_name
The name of this machine's zone. It comes from the TZ environment variable if that names a zone (: before the name and a path ending in zoneinfo/Area/City are both understood, and an empty TZ means UTC), then from the name /etc/localtime links to, then /etc/timezone, then /etc/sysconfig/clock, and on Windows from the system's time zone setting. When none of them names a zone it is Etc/UTC. Only names are read: the system's own zone files never are.
tzdata_version
The release of the IANA time zone database compiled in, such as 2026e.
countries
Every country with a zone, as pairs of its ISO 3166 code and its name.
zones_for_country($code)
The zones a country uses, from the database's zone.tab, given its two-letter code in any case. A country whose clocks follow another's still has its own zone here: Norway's is Europe/Oslo. An empty list for a code that is not there.
windows_zone($windows_name)
The zone a Windows time zone name means, such as Europe/London for GMT Standard Time, from CLDR's table. Undef for a name it does not know.
AUTHOR
LNATION <email@lnation.org>
BUGS
Please report any bugs or feature requests to bug-time-keeper-zone at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Time-Keeper-Zone.
LICENSE AND COPYRIGHT
This software is Copyright (c) 2026 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)