{
    "mode": "perldoc",
    "parameter": "DateTime::TimeZone::Local::Unix",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/DateTime%3A%3ATimeZone%3A%3ALocal%3A%3AUnix/json",
    "generated": "2026-06-11T23:52:08Z",
    "synopsis": "my $tz = DateTime::TimeZone->new( name => 'local' );\nmy $tz = DateTime::TimeZone::Local->TimeZone();",
    "sections": {
        "NAME": {
            "content": "DateTime::TimeZone::Local::Unix - Determine the local system's time zone on Unix\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 2.51\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "my $tz = DateTime::TimeZone->new( name => 'local' );\n\nmy $tz = DateTime::TimeZone::Local->TimeZone();\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module provides methods for determining the local time zone on a Unix platform.\n",
            "subsections": []
        },
        "HOW THE TIME ZONE IS DETERMINED": {
            "content": "This class tries the following methods of determining the local time zone:\n\n*   $ENV{TZ}\n\nIt checks $ENV{TZ} for a valid time zone name.\n\n*   /etc/localtime\n\nIf this file is a symlink to an Olson database time zone file (usually in\n/usr/share/zoneinfo) then it uses the target file's path name to determine the time zone\nname. For example, if the path is /usr/share/zoneinfo/America/Chicago, the time zone is\n\"America/Chicago\".\n\nSome systems just copy the relevant file to /etc/localtime instead of making a symlink. In\nthis case, we look in /usr/share/zoneinfo for a file that has the same size and content as\n/etc/localtime to determine the local time zone.\n\n*   /etc/timezone\n\nIf this file exists, it is read and its contents are used as a time zone name.\n\n*   /etc/TIMEZONE\n\nIf this file exists, it is opened and we look for a line starting like \"TZ = ...\". If this\nis found, it should indicate a time zone name.\n\n*   /etc/sysconfig/clock\n\nIf this file exists, it is opened and we look for a line starting like \"TIMEZONE = ...\" or\n\"ZONE = ...\". If this is found, it should indicate a time zone name.\n\n*   /etc/default/init\n\nIf this file exists, it is opened and we look for a line starting like \"TZ=...\". If this is\nfound, it should indicate a time zone name.\n\nNote: Some systems such as virtual machine boxes may lack any of these files. You can confirm\nthat this is case by running:\n\n$ ls -l /etc/localtime /etc/timezone /etc/TIMEZONE \\\n/etc/sysconfig/clock /etc/default/init\n\nIf this is the case, then when checking for timezone handling you are likely to get an\nexception:\n\n$ perl -wle 'use DateTime; DateTime->now( timezone => \"local\" )'\nCannot determine local time zone\n\nIn that case, you should consult your system man pages for details on how to address that\nproblem. In one such case reported to us, a FreeBSD virtual machine had been built without any\nof these files. The user was able to run the FreeBSD tzsetup utility. That installed\n/etc/localtime, after which the above timezone diagnostic ran silently, *i.e.*, without throwing\nan exception.\n",
            "subsections": []
        },
        "SUPPORT": {
            "content": "Bugs may be submitted at <https://github.com/houseabsolute/DateTime-TimeZone/issues>.\n",
            "subsections": []
        },
        "SOURCE": {
            "content": "The source code repository for DateTime-TimeZone can be found at\n<https://github.com/houseabsolute/DateTime-TimeZone>.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Dave Rolsky <autarch@urth.org>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is copyright (c) 2021 by Dave Rolsky.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n\nThe full text of the license can be found in the LICENSE file included with this distribution.\n",
            "subsections": []
        }
    },
    "summary": "DateTime::TimeZone::Local::Unix - Determine the local system's time zone on Unix",
    "flags": [],
    "examples": [],
    "see_also": []
}