1DateTime::TimeZone::LocUasle:r:UCnoinxt(r3i)buted Perl DDoactuemTeinmtea:t:iToinmeZone::Local::Unix(3)
2
3
4
6 DateTime::TimeZone::Local::Unix - Determine the local system's time
7 zone on Unix
8
10 my $tz = DateTime::TimeZone->new( name => 'local' );
11
12 my $tz = DateTime::TimeZone::Local->TimeZone();
13
15 This module provides methods for determining the local time zone on a
16 Unix platform.
17
19 This class tries the following methods of determining the local time
20 zone:
21
22 · $ENV{TZ}
23
24 It checks $ENV{TZ} for a valid time zone name.
25
26 · /etc/localtime
27
28 If this file is a symlink to an Olson database time zone file
29 (usually in /usr/share/zoneinfo) then it uses the target file's
30 path name to determine the time zone name. For example, if the path
31 is /usr/share/zoneinfo/America/Chicago, the time zone is
32 "America/Chicago".
33
34 Some systems just copy the relevant file to /etc/localtime instead
35 of making a symlink. In this case, we look in /usr/share/zoneinfo
36 for a file that has the same size and content as /etc/localtime to
37 determine the local time zone.
38
39 · /etc/timezone
40
41 If this file exists, it is read and its contents are used as a time
42 zone name.
43
44 · /etc/TIMEZONE
45
46 If this file exists, it is opened and we look for a line starting
47 like "TZ = ...". If this is found, it should indicate a time zone
48 name.
49
50 · /etc/sysconfig/clock
51
52 If this file exists, it is opened and we look for a line starting
53 like "TIMEZONE = ..." or "ZONE = ...". If this is found, it should
54 indicate a time zone name.
55
56 · /etc/default/init
57
58 If this file exists, it is opened and we look for a line starting
59 like "TZ=...". If this is found, it should indicate a time zone
60 name.
61
63 Dave Rolsky, <autarch@urth.org>
64
66 Copyright (c) 2003-2008 David Rolsky. All rights reserved. This
67 program is free software; you can redistribute it and/or modify it
68 under the same terms as Perl itself.
69
70 The full text of the license can be found in the LICENSE file included
71 with this module.
72
73
74
75perl v5.10.1 2017-03-21DateTime::TimeZone::Local::Unix(3)