DateTime::TimeZone::Local::Unix - Determine the local system's time zone on Unix


DateTime-TimeZone documentation  | view source Contained in the DateTime-TimeZone distribution.

Index


NAME

Top

DateTime::TimeZone::Local::Unix - Determine the local system's time zone on Unix

VERSION

Top

version 1.34

SYNOPSIS

Top

  my $tz = DateTime::TimeZone->new( name => 'local' );

  my $tz = DateTime::TimeZone::Local->TimeZone();

DESCRIPTION

Top

This module provides methods for determining the local time zone on a Unix platform.

HOW THE TIME ZONE IS DETERMINED

Top

This class tries the following methods of determining the local time zone:

* $ENV{TZ}

It checks $ENV{TZ} for a valid time zone name.

* /etc/localtime

If this file is a symlink to an Olson database time zone file (usually in /usr/share/zoneinfo) then it uses the target file's path name to determine the time zone name. For example, if the path is /usr/share/zoneinfo/America/Chicago, the time zone is "America/Chicago".

Some systems just copy the relevant file to /etc/localtime instead of making a symlink. In this case, we look in /usr/share/zoneinfo for a file that has the same size and content as /etc/localtime to determine the local time zone.

* /etc/timezone

If this file exists, it is read and its contents are used as a time zone name.

* /etc/TIMEZONE

If this file exists, it is opened and we look for a line starting like "TZ = ...". If this is found, it should indicate a time zone name.

* /etc/sysconfig/clock

If this file exists, it is opened and we look for a line starting like "TIMEZONE = ..." or "ZONE = ...". If this is found, it should indicate a time zone name.

* /etc/default/init

If this file exists, it is opened and we look for a line starting like "TZ=...". If this is found, it should indicate a time zone name.

AUTHOR

Top

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE

Top


DateTime-TimeZone documentation  | view source Contained in the DateTime-TimeZone distribution.