DateTi...SystemV(3pm)
π NAME π
bestie, you're looking at DateTime::TimeZone::SystemV(3pm) β that's the User Contributed Perl Documentation page β and it is literally serving System V and POSIX timezone strings. periodt. β¨
β¨ SYNOPSIS β¨
okay so the synopsis is giving exactly this:
use DateTime::TimeZone::SystemV;
$tz = DateTime::TimeZone::SystemV->new(
name => "US Eastern",
recipe => "EST5EDT,M3.2.0,M11.1.0");
$tz = DateTime::TimeZone::SystemV->new(
"EST5EDT,M3.2.0,M11.1.0");
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);
πΈ DESCRIPTION πΈ
okay so picture this: one instance of this class = one timezone, and that timezone was specified by a System V timezone recipe β or by the extended glow-up of that same syntax, like the one POSIX uses. π
these can express a plain offset from Universal Time, or a whole system of two offsets β standard time and daylight saving time β switching on a yearly cycle according to certain types of rule. π¦
and yes, this class implements the DateTime::TimeZone interface, so its instances can be used with DateTime objects. no cap. π«Ά
π¦ SYSTEM V TIMEZONE RECIPE SYSTEM π¦
this module supports multiple versions of the timezone recipe syntax derived from System V. specifically, it supports the version specified by POSIX.1, plus the extension of the POSIX format used by version 3 of the tzfile(5) file format. β¨
a timezone may be specified with a fixed offset by the syntax aaaooo, or as a timezone with DST by the syntax aaaoooaaa[ooo],rrr,rrr. here aaa specifies an abbreviation by which an offset is known, ooo specifies the offset, and rrr is a rule for when DST starts or ends. for backward compatibility, the rules part may also be omitted from a DST-using timezone, in which case some built-in default rules are used β but bestie, don't rely on those rules being useful. π
an abbreviation must be a string of three or more characters from ASCII alphanumerics, +, and -. if it contains only ASCII alphabetic characters, then the abbreviation specification aaa may be simply the abbreviation. otherwise aaa must consist of the abbreviation wrapped in angle brackets (<...>). the angle bracket form is always allowed. POSIX allows an implementation to set an upper limit on the length of timezone abbreviations. that limit is known as TZNAME_MAX, and is required to be no less than 6 (characters/bytes). abbreviations longer than 6 characters are therefore not portable. this class imposes no such limit. π
an offset from Universal Time, ooo, is given in hours, or hours and minutes, or hours and minutes and seconds, with an optional preceding sign. hours, minutes, and seconds must be separated by colons. the hours may be one or two digits, and the minutes and seconds must be two digits each. the maximum magnitude permitted is 24:59:59. the sign in the specification is the opposite of the sign of the actual offset. if no sign is given, then the default is +, meaning a timezone that is behind UT β or equal to UT if the offset is zero. if no DST offset is specified, it defaults to one hour ahead of the standard offset. π
a DST-using timezone has one transition to DST and one transition to standard time in each Gregorian year. the transitions may be in either order within the year. if the transitions are in different orders from year to year, then the behaviour is undefined β don't rely on it remaining the same in future versions. likewise, the behaviour is generally undefined if transitions coincide. however, in the tzfile(5) variant, if the rules specify a transition to DST at 00:00 standard time on 1 January and a transition to standard time at 24:00 standard time on 31 December, which makes the transitions coincide with those of adjacent years, then the timezone is treated as observing DST all year. π
β οΈ undefined-behaviour alert: the "different orders from year to year" situation and the "transitions coincide" situation are not your bestie. do not build your whole personality on them staying the same.
a transition rule rrr takes the form ddd[/ttt], where ddd is the rule giving the day on which the transition notionally takes place, and ttt is the time of day at which the transition takes place. (a time of day outside the usual 24-hour range can make the transition actually take place on a different day.) the time may be given in hours, or hours and minutes, or hours and minutes and seconds. hours, minutes, and seconds must be separated by colons. the minutes and seconds must be two digits each. in the POSIX variant, the hours may be one or two digits, with no preceding sign, and the time stated may range from 00:00:00 to 24:59:59 (almost an hour into the following day). in the tzfile(5) variant, the hours may be one to three digits, with an optional preceding sign, and the time stated may range from -167:59:59 to +167:59:59 (a span of a little over two weeks). if the time is not stated, then it defaults to 02:00:00. the time for the transition to DST is interpreted according to the standard offset, and the time for the transition to standard time is interpreted according to the DST offset. (thus normally the transition time is interpreted according to the offset that prevailed immediately before the transition.) π
a day rule ddd may take three forms. firstly, Jnnn means the month-day date that is the nnnth day of a non-leap year. thus J59 means February 28 and J60 means March 1 (even in a leap year). February 29 cannot be specified this way. πΈ
secondly, if ddd is just a decimal number, it means the (1+ddd)th day of the year. February 29 counts in this case, and it is not possible to specify December 31 of a leap year. π¦
thirdly, ddd may have the form Mm.w.d β that means day d of the wth week of the mth month. the day is given as a single digit, with 0 meaning Sunday and 6 meaning Saturday. the first week contains days 1 to 7 of the month, the second week contains days 8 to 14, and so on. if w is 5, then the last week of the month (containing its last seven days) is used, rather than the fifth week (which is incomplete). π
examples, bestie β these are iconic:
MUT-4β Mauritius time, since 1907: 4 hours ahead of UT all year. πEST5EDT,M3.2.0,M11.1.0β US Eastern timezone with DST, from 2007 onwards. 5 hours behind UT in winter and 4 hours behind in summer. changes on the second Sunday in March and the first Sunday in November, in each case at 02:00 local time. πΊπΈNST3:30NDT,M3.2.0/0:01,M11.1.0/0:01β Newfoundland timezone with DST, from 2007 onwards. 3.5 hours behind UT in winter and 2.5 hours behind in summer. changes on the second Sunday in March and the first Sunday in November, in each case at 00:01 local time. πGMT0BST,M3.5.0/1,M10.5.0β UK civil time, from 1996 onwards. on UT during the winter, calling itGMT, and 1 hour ahead of UT during the summer, calledBST. changes on the last Sunday in March and the last Sunday in October, in each case at 01:00 UT. πEST-10EST,M10.5.0,M3.5.0/3β Australian Eastern timezone, from 2007 onwards. 10 hours ahead of UT in the southern winter (the middle of the calendar year), and 11 hours ahead in the southern summer. changes to DST on the last Sunday in October, and back on the last Sunday in March, in each case at 02:00 standard time (16:00 UT of the preceding day). π¦EET-2EEST,M3.5.4/24,M9.3.6/145β Palestinian civil time, from 2012 onwards. 2 hours ahead of UT in winter and 3 hours ahead in summer. changes at the end (24:00 local time) of the last Thursday in March and 01:00 local time on the Friday following the third Saturday in September (that is, the Friday falling between September 21 and September 27 inclusive). the extended time-of-day145, meaning 01:00 of the day six days after the nominal day, is only valid in thetzfile(5)variant of the System V syntax. the time-of-day24is not so restricted, being permitted by POSIX. π
π CONSTRUCTOR π
DateTime::TimeZone::SystemV->new(ATTR => VALUE, ...)
constructs and returns a DateTime-compatible timezone object that implements the timezone described by the recipe given in the arguments. the following attributes may be given: β¨
nameβ name for the timezone object. this will be returned by thenamemethod described below, and will be included in certain error messages. if not given, then the recipe is used as the timezone name. πrecipeβ the short textual timezone recipe, as described in "SYSTEM V TIMEZONE RECIPE SYSTEM". must be given. π¨systemβ keyword identifying the particular variant of the recipe system according to which the recipe is to be interpreted. it may be:posix(default) β as specified by POSIX.1. πtzfile3β as specified by version 3 of thetzfile(5)file format. ποΈ
DateTime::TimeZone::SystemV->new(RECIPE)
simpler way to invoke the above constructor in the usual case. only the recipe is given; it will be interpreted according to the POSIX system, and the recipe will also be used as the timezone name. slay. π
π METHODS π
okay bestie, real talk: these methods are all part of the DateTime::TimeZone interface. Slide over to that class for the general meaning of these methods β the tea below is only about the specific behaviour of this class. periodt. β¨
πͺͺ Identification πͺͺ
$tz->is_floatingβ returnsfalse. that's it, no floating vibes here. π$tz->is_utcβ returnsfalse. not UTC, bestie. π$tz->is_olsonβ returnsfalse. also no Olson energy. πΈ$tz->categoryβ returnsundef, because the category concept doesn't properly apply to these timezones. it's giving "not applicable" and honestly same. π$tz->nameβ returns the timezone name. Usually this is the recipe that was supplied to the constructor, but it can be overridden by the constructor'snameattribute. iykyk. π
β° Offsets β°
$tz->has_dst_changesβ returns a truth value indicating whether the timezone includes a DST offset. lowkey important info. π₯$tz->is_dst_for_datetime(DT)βDTmust be a DateTime-compatible object (specifically, it must implement theutc_rd_valuesmethod). Returns a truth value indicating whether the timezone is on DST at the instant represented byDT. π$tz->offset_for_datetime(DT)βDTmust be a DateTime-compatible object (specifically, it must implement theutc_rd_valuesmethod). Returns the offset from UT that is in effect at the instant represented byDT, in seconds. numbers, but make them seconds. β±οΈ$tz->short_name_for_datetime(DT)βDTmust be a DateTime-compatible object (specifically, it must implement theutc_rd_valuesmethod). Returns the time scale abbreviation for the offset that is in effect at the instant represented byDT. the little nickname for the offset, slay. π¦$tz->offset_for_local_datetime(DT)βDTmust be a DateTime-compatible object (specifically, it must implement thelocal_rd_valuesmethod). Takes the local time represented byDT(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 inDT). Returns the offset from UT that is in effect at that local time, in seconds.
If the local time given is ambiguous due to a nearby offset change, the numerically lower offset (usually the standard one) is returned with no warning of the situation. If the local time given does not exist due to a nearby offset change, the method dies saying so. so yeah: ambiguous = lower offset, nonexistent = die, no cap. π
π SEE ALSO π
go peek at DateTime, DateTime::TimeZone, POSIX.1, <http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap08.html>, and tzfile(5). that's the whole friend group. π«Ά
π AUTHOR π
Andrew Main (Zefram) <zefram@fysh.org> wrote this. iconic. π
π COPYRIGHT π
Copyright (C) 2007, 2009, 2010, 2011, 2012, 2013, 2017 Andrew Main (Zefram) <zefram@fysh.org>
π LICENSE π
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay, free software rights. π«Ά
That's the whole vibe, bestie: this page is from perl v5.40.0, dated 2023-01-20, and it's the DateTi...SystemV(3pm) page. go off, timezone icon. π
β¨
π¦ where this page comes from
- epel 10: perl-DateTime-TimeZone-SystemV 0.010-18.el10_0 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms