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 version 1.70
11
13 my $tz = DateTime::TimeZone->new( name => 'local' );
14
15 my $tz = DateTime::TimeZone::Local->TimeZone();
16
18 This module provides methods for determining the local time zone on a
19 Unix platform.
20
22 This class tries the following methods of determining the local time
23 zone:
24
25 · $ENV{TZ}
26
27 It checks $ENV{TZ} for a valid time zone name.
28
29 · /etc/localtime
30
31 If this file is a symlink to an Olson database time zone file
32 (usually in /usr/share/zoneinfo) then it uses the target file's
33 path name to determine the time zone name. For example, if the path
34 is /usr/share/zoneinfo/America/Chicago, the time zone is
35 "America/Chicago".
36
37 Some systems just copy the relevant file to /etc/localtime instead
38 of making a symlink. In this case, we look in /usr/share/zoneinfo
39 for a file that has the same size and content as /etc/localtime to
40 determine the local time zone.
41
42 · /etc/timezone
43
44 If this file exists, it is read and its contents are used as a time
45 zone name.
46
47 · /etc/TIMEZONE
48
49 If this file exists, it is opened and we look for a line starting
50 like "TZ = ...". If this is found, it should indicate a time zone
51 name.
52
53 · /etc/sysconfig/clock
54
55 If this file exists, it is opened and we look for a line starting
56 like "TIMEZONE = ..." or "ZONE = ...". If this is found, it should
57 indicate a time zone name.
58
59 · /etc/default/init
60
61 If this file exists, it is opened and we look for a line starting
62 like "TZ=...". If this is found, it should indicate a time zone
63 name.
64
66 Dave Rolsky <autarch@urth.org>
67
69 This software is copyright (c) 2014 by Dave Rolsky.
70
71 This is free software; you can redistribute it and/or modify it under
72 the same terms as the Perl 5 programming language system itself.
73
74
75
76perl v5.16.3 2014-06-01DateTime::TimeZone::Local::Unix(3)