.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "DateTime::TimeZone::Tzfile 3pm" .TH DateTime::TimeZone::Tzfile 3pm "2017-08-03" "perl v5.26.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" DateTime::TimeZone::Tzfile \- tzfile (zoneinfo) timezone files .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use DateTime::TimeZone::Tzfile; \& \& $tz = DateTime::TimeZone::Tzfile\->new( \& name => "local timezone", \& filename => "/etc/localtime"); \& $tz = DateTime::TimeZone::Tzfile\->new("/etc/localtime"); \& \& if($tz\->is_floating) { ... \& if($tz\->is_utc) { ... \& if($tz\->is_olson) { ... \& $category = $tz\->category; \& $tz_string = $tz\->name; \& \& if($tz\->has_dst_changes) { ... \& if($tz\->is_dst_for_datetime($dt)) { ... \& $offset = $tz\->offset_for_datetime($dt); \& $abbrev = $tz\->short_name_for_datetime($dt); \& $offset = $tz\->offset_for_local_datetime($dt); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" An instance of this class represents a timezone that was encoded in a file in the \fItzfile\fR\|(5) format. These can express arbitrary patterns of offsets from Universal Time, changing over time. Offsets and change times are limited to a resolution of one second. .PP This class implements the DateTime::TimeZone interface, so that its instances can be used with DateTime objects. .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" .IP "DateTime::TimeZone::Tzfile\->new(\s-1ATTR\s0 => \s-1VALUE, ...\s0)" 4 .IX Item "DateTime::TimeZone::Tzfile->new(ATTR => VALUE, ...)" Reads and parses a \fItzfile\fR\|(5) format file, then constructs and returns a DateTime\-compatible timezone object that implements the timezone encoded in the file. The following attributes may be given: .RS 4 .IP "\fBname\fR" 4 .IX Item "name" Name for the timezone object. This will be returned by the \f(CW\*(C`name\*(C'\fR method described below, and will be included in certain error messages. .IP "\fBcategory\fR" 4 .IX Item "category" The string or \f(CW\*(C`undef\*(C'\fR that will be returned by the \f(CW\*(C`category\*(C'\fR method described below. Default \f(CW\*(C`undef\*(C'\fR. .IP "\fBis_olson\fR" 4 .IX Item "is_olson" The truth value that will be returned by the \f(CW\*(C`is_olson\*(C'\fR method described below. Default false. .IP "\fBfilename\fR" 4 .IX Item "filename" Name of the file from which to read the timezone data. The filename must be understood by IO::File. .IP "\fBfilehandle\fR" 4 .IX Item "filehandle" An IO::Handle object from which the timezone data can be read. This does not need to be a regular seekable file; it is read sequentially. After the constructor has finished, the handle can still be used to read any data that follows the timezone data. .RE .RS 4 .Sp Either a filename or filehandle must be given. If a timezone name is not given, then the filename is used instead if supplied; a timezone name must be given explicitly if no filename is given. .RE .IP "DateTime::TimeZone::Tzfile\->new(\s-1FILENAME\s0)" 4 .IX Item "DateTime::TimeZone::Tzfile->new(FILENAME)" Simpler way to invoke the above constructor in the usual case. Only the filename is given; this will also be used as the timezone name. .SH "METHODS" .IX Header "METHODS" These methods are all part of the DateTime::TimeZone interface. See that class for the general meaning of these methods; the documentation below only comments on the specific behaviour of this class. .SS "Identification" .IX Subsection "Identification" .ie n .IP "$tz\->is_floating" 4 .el .IP "\f(CW$tz\fR\->is_floating" 4 .IX Item "$tz->is_floating" Returns false. .ie n .IP "$tz\->is_utc" 4 .el .IP "\f(CW$tz\fR\->is_utc" 4 .IX Item "$tz->is_utc" Returns false. .ie n .IP "$tz\->is_olson" 4 .el .IP "\f(CW$tz\fR\->is_olson" 4 .IX Item "$tz->is_olson" Returns the truth value that was provided to the constructor for this purpose, default false. This nominally indicates whether the timezone data is from the Olson database. The files interpreted by this class are very likely to be from the Olson database, but there is no explicit indicator for this in the file, so this information must be supplied to the constructor if required. .ie n .IP "$tz\->category" 4 .el .IP "\f(CW$tz\fR\->category" 4 .IX Item "$tz->category" Returns the value that was provided to the constructor for this purpose, default \f(CW\*(C`undef\*(C'\fR. This is intended to indicate the general region (continent or ocean) in which a geographical timezone is used, when the timezone is named according to the hierarchical scheme of the Olson timezone database. .ie n .IP "$tz\->name" 4 .el .IP "\f(CW$tz\fR\->name" 4 .IX Item "$tz->name" Returns the timezone name. Usually this is the filename that was supplied to the constructor, but it can be overridden by the constructor's \fBname\fR attribute. .SS "Offsets" .IX Subsection "Offsets" .ie n .IP "$tz\->has_dst_changes" 4 .el .IP "\f(CW$tz\fR\->has_dst_changes" 4 .IX Item "$tz->has_dst_changes" Returns a truth value indicating whether any of the observances in the file are marked as \s-1DST.\s0 These \s-1DST\s0 flags are potentially arbitrary, and don't affect any of the zone's behaviour. .ie n .IP "$tz\->offset_for_datetime(\s-1DT\s0)" 4 .el .IP "\f(CW$tz\fR\->offset_for_datetime(\s-1DT\s0)" 4 .IX Item "$tz->offset_for_datetime(DT)" \&\fI\s-1DT\s0\fR must be a DateTime\-compatible object (specifically, it must implement the \f(CW\*(C`utc_rd_values\*(C'\fR method). Returns the offset from \s-1UT\s0 that is in effect at the instant represented by \fI\s-1DT\s0\fR, in seconds. .ie n .IP "$tz\->is_dst_for_datetime(\s-1DT\s0)" 4 .el .IP "\f(CW$tz\fR\->is_dst_for_datetime(\s-1DT\s0)" 4 .IX Item "$tz->is_dst_for_datetime(DT)" \&\fI\s-1DT\s0\fR must be a DateTime\-compatible object (specifically, it must implement the \f(CW\*(C`utc_rd_values\*(C'\fR method). Returns a truth value indicating whether the timezone's observance at the instant represented by \fI\s-1DT\s0\fR is marked as \s-1DST.\s0 This \s-1DST\s0 flag is potentially arbitrary, and doesn't affect anything else. .ie n .IP "$tz\->short_name_for_datetime(\s-1DT\s0)" 4 .el .IP "\f(CW$tz\fR\->short_name_for_datetime(\s-1DT\s0)" 4 .IX Item "$tz->short_name_for_datetime(DT)" \&\fI\s-1DT\s0\fR must be a DateTime\-compatible object (specifically, it must implement the \f(CW\*(C`utc_rd_values\*(C'\fR method). Returns the abbreviation used to label the time scale at the instant represented by \fI\s-1DT\s0\fR. This abbreviation is potentially arbitrary, and does not uniquely identify either the timezone or the offset. .ie n .IP "$tz\->offset_for_local_datetime(\s-1DT\s0)" 4 .el .IP "\f(CW$tz\fR\->offset_for_local_datetime(\s-1DT\s0)" 4 .IX Item "$tz->offset_for_local_datetime(DT)" \&\fI\s-1DT\s0\fR must be a DateTime\-compatible object (specifically, it must implement the \f(CW\*(C`local_rd_values\*(C'\fR method). Takes the local time represented by \fI\s-1DT\s0\fR (regardless of what absolute time it also represents), and interprets that as a local time in the timezone of the timezone object (not the timezone used in \fI\s-1DT\s0\fR). Returns the offset from \s-1UT\s0 that is in effect at that local time, in seconds. .Sp If the local time given is ambiguous due to a nearby offset change, the numerically lowest offset (usually the standard one) is returned with no warning of the situation. (Equivalently: the latest possible absolute time is indicated.) If the local time given does not exist due to a nearby offset change, the method \f(CW\*(C`die\*(C'\fRs saying so. .SH "SEE ALSO" .IX Header "SEE ALSO" DateTime, DateTime::TimeZone, DateTime::TimeZone::Olson, Time::OlsonTZ::Data, Time::OlsonTZ::Download, \&\fItzfile\fR\|(5) .SH "AUTHOR" .IX Header "AUTHOR" Andrew Main (Zefram) .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2007, 2009, 2010, 2011, 2012, 2013, 2017 Andrew Main (Zefram) .SH "LICENSE" .IX Header "LICENSE" This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.