RFC 8536
The Time Zone Information Format (TZif)
RFC 8536: The Time Zone Information Format (TZif) ๐ฐ๏ธ๐ฆ
Internet Engineering Task Force (IETF) ๐ธ Authors: A. Olson, P. Eggert (UCLA), and K. Murchison (FastMail) ๐ Category: Standards Track ๐ ISSN: 2070-1721 โจ Date: February 2019 ๐ Obsoletes / Updates: nothing listed in the header ๐
Abstract โจ
okay so this doc specifies the Time Zone Information Format (TZif) ๐ฐ๏ธ for representing and exchanging time zone info, and it's totally independent of any particular service or protocol ๐ซถ. It also defines two media types for the format. iconic.
Status of This Memo ๐
this is an Internet Standards Track document ๐ฅ.
it's a product of the Internet Engineering Task Force (IETF), so it represents the consensus of the IETF community. it got public review and was approved for publication by the Internet Engineering Steering Group (IESG). for more on Internet Standards, check out Section 2 of RFC 7841 ๐ง.
for the current status, any errata, and how to give feedback, go to https://www.rfc-editor.org/info/rfc8536 ๐.
Copyright Notice ยฉ๏ธ
Copyright (c) 2019 IETF Trust and the persons identified as the document authors. All rights reserved ๐.
this doc is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) as in effect on the date of publication. please read these carefully, because they describe your rights and restrictions for this doc ๐. also, Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions, and they come without warranty as described in the Simplified BSD License ๐
.
Table of Contents ๐บ๏ธ
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
2. Conventions Used in This Document . . . . . . . . . . . . . . 3
3. The Time Zone Information Format (TZif) . . . . . . . . . . . 5
3.1. TZif Header . . . . . . . . . . . . . . . . . . . . . . . 6
3.2. TZif Data Block . . . . . . . . . . . . . . . . . . . . . 8
3.3. TZif Footer . . . . . . . . . . . . . . . . . . . . . . . 12
3.3.1. TZ String Extensions . . . . . . . . . . . . . . . . 13
4. Interoperability Considerations . . . . . . . . . . . . . . . 13
5. Use with the Time Zone Data Distribution Service . . . . . . 14
5.1. Truncating TZif Files . . . . . . . . . . . . . . . . . . 15
5.2. Example TZDIST Request for TZif Data . . . . . . . . . . 15
6. Security Considerations . . . . . . . . . . . . . . . . . . . 17
7. Privacy Considerations . . . . . . . . . . . . . . . . . . . 17
8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 17
8.1. application/tzif . . . . . . . . . . . . . . . . . . . . 17
8.2. application/tzif-leap . . . . . . . . . . . . . . . . . . 18
9. References . . . . . . . . . . . . . . . . . . . . . . . . . 19
9.1. Normative References . . . . . . . . . . . . . . . . . . 19
9.2. Informative References . . . . . . . . . . . . . . . . . 20
Appendix A. Common Interoperability Issues . . . . . . . . . . . 21
Appendix B. Example TZif Files . . . . . . . . . . . . . . . . . 23
B.1. Version 1 File Representing UTC (with Leap Seconds) . . . 24
B.2. Version 2 File Representing Pacific/Honolulu . . . . . . 28
B.3. Truncated Version 3 File Representing Asia/Jerusalem . . 33
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 34
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 34
1. Introduction ๐ท
okay so time zone data usually includes offsets from universal time (UT) ๐, daylight saving transition rules, one or more local time designations (acronyms or abbreviations) ๐ท๏ธ, and optional leap-second adjustments โฑ๏ธ. one format for passing this info around is iCalendar [RFC5545]. it's text-based and used by calendaring and scheduling systems ๐.
this document specifies the widely deployed Time Zone Information Format (TZif) ๐ . it's a binary format that most UNIX systems use to calculate local time, and it was introduced in the 1980s and has since evolved into multiple upward-compatible versions ๐ฆ. there's a huge variety of interoperable software that can generate and read files in this format [tz-link] โจ. literally so iconic.
this spec does not define where the data assembled into a TZif file comes from. one such source is the IANA-hosted time zone database [RFC6557] ๐ง.
2. Conventions Used in This Document ๐
bestie, the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here ๐ฅ. so lowercase versions are just regular words, no cap ๐.
the following terms are used in this doc (see "Sources for Time Zone and Daylight Saving Time Data" [tz-link] for more detailed info about civil timekeeping data and practice) ๐ธ:
Coordinated Universal Time (UTC): the basis for civil time since 1960. it's approximately equal to mean solar time at the prime meridian (0 degrees longitude) ๐.
Daylight Saving Time (DST): the time according to a location's law or practice, when adjusted as necessary from standard time. the adjustment may be positive or negative, and the amount of adjustment may vary depending on the date and time. the TZif format even allows the adjustment to be zero, although this is not common practice ๐.
International Atomic Time (TAI): the time standard based on atomic clocks since 1972. it's equal to UTC but without leap-second adjustments โ๏ธ.
Leap-Second Correction (LEAPCORR): the value of TAI - UTC - 10 for timestamps after the first leap second, and zero for timestamps before that. the expression "TAI - UTC - 10" comes from the fact that TAI - UTC was defined to be 10 just prior to the first leap second in 1972, so clocks with leap seconds have a zero LEAPCORR before the first leap second ๐งฎ.
Local Time: civil time for a particular location. its offset from universal time can depend on the date and time of day ๐.
POSIX Epoch: 1970-01-01 00:00:00 UTC, the basis for absolute timestamps in this document โญ.
Standard Time: the time according to a location's law or practice, unadjusted for Daylight Saving Time ๐.
Time Change: a change to civil timekeeping practice. it happens when one or more of the following occur simultaneously ๐:
- a change in UT offset
- a change in whether daylight saving time is in effect
- a change in time zone abbreviation
- a leap second (i.e., a change in LEAPCORR)
Time Zone Data: the Time Zone Data Distribution Service (TZDIST) [RFC7808] defines "Time zone data" as "data that defines a single time zone, including an identifier, UTC offset values, DST rules, and other information such as time zone abbreviations." the interchange format defined in this document is one such form of time zone data ๐.
Transition Time: the moment a time change occurs that is not a leap second. it's identified with a signed integer count of UNIX leap time seconds since the POSIX epoch ๐ฆ.
Universal Time (UT): the basis of civil time. this is the principal form of the mean solar time at the prime meridian (0 degrees longitude) for timestamps before UTC was introduced in 1960, and it's UTC for timestamps after that. although UT is sometimes called "UTC" or "GMT" in other sources, this specification uses the term "UT" to avoid confusion with UTC or with GMT ๐.
UNIX Time: the time as returned by the time() function provided by the C programming language (see Section 3 of the "System Interfaces" volume of [POSIX]). it's an integer number of seconds since the POSIX epoch, not counting leap seconds. as an extension to POSIX, negative values represent times before the POSIX epoch, using UT ๐.
UNIX Leap Time: UNIX time plus all preceding leap-second corrections. for example, if the first leap-second record in a TZif file occurs at 1972-06-30 23:59:60 UTC, the UNIX leap time for the timestamp 1972-07-01 00:00:00 UTC would be 78796801, one greater than the UNIX time for the same timestamp. similarly, if the second leap-second record occurs at 1972-12-31 23:59:60 UTC, it accounts for the first leap second, so the UNIX leap time of 1972-12-31 23:59:60 UTC would be 94694401, and the UNIX leap time of 1973-01-01 00:00:00 UTC would be 94694402. if a TZif file specifies no leap-second records, UNIX leap time is equal to UNIX time ๐ง .
Wall Time: another name for local time, short for "wall-clock time" โฐ.
3. The Time Zone Information Format (TZif) โจ
okay so section 3 is where the file format actually lives ๐ TZif starts with a fixed 44-octet version 1 header (Section 3.1) that has a version field saying which format the file uses. Readers built for version N can usually handle version N+1 files without too much drama ๐ Newer data either goes after the older data, so older readers can just skip the stuff they don't understand, or it's a small tweak to version N that version N readers will probably tolerate just fine ๐ฆ
The version 1 header is followed by a variable-length version 1 data block (Section 3.2) with four-octet (32-bit) transition times and leap-second occurrences. These 32-bit values can only represent time changes from 1901-12-13 20:45:52 through 2038-01-19 03:14:07 UT ๐ญ The version 1 header and data block are only there for backward compatibility with obsolescent readers, as covered in Common Interoperability Issues (Appendix A) ๐ธ
Version 1 files end right after the version 1 data block ๐ Files from versions 2 and 3 keep going: they add a second 44-octet version 2+ header, a variable-length version 2+ data block with eight-octet (64-bit) transition times and leap-second occurrences, and a variable-length footer (Section 3.3). These 64-bit values can represent times roughly 292 billion years into the past or future. Literally iconic ๐
NOTE: All multi-octet integer values MUST be stored in network octet order format (high-order octet first, otherwise known as big-endian), with all bits significant. Signed integer values MUST be represented using two's complement. ๐ฅ this is the main vibe check for the whole file, so don't skip it bestie ๐ซถ
A TZif file is structured as follows:
Version 1 Versions 2 & 3
+-------------+ +-------------+
| Version 1 | | Version 1 |
| Header | | Header |
+-------------+ +-------------+
| Version 1 | | Version 1 |
| Data Block | | Data Block |
+-------------+ +-------------+
| Version 2+ |
| Header |
+-------------+
| Version 2+ |
| Data Block |
+-------------+
| Footer |
+-------------+
General Format of TZif Files
3.1. TZif Header
ok the header is where the vibes get organised ๐ง A TZif header is structured as follows (the lengths of multi-octet fields are shown in parentheses):
+---------------+---+
| magic (4) |ver|
+---------------+---+---------------------------------------+
| [unused - reserved for future use] (15) |
+---------------+---------------+---------------+-----------+
| isutcnt (4) | isstdcnt (4) | leapcnt (4) |
+---------------+---------------+---------------+
| timecnt (4) | typecnt (4) | charcnt (4) |
+---------------+---------------+---------------+
TZif Header
The fields of the header work like this ๐
magic: The four-octet ASCII [RFC20] sequence "TZif" (0x54 0x5A 0x69 0x66). This is how a file says "yep, I'm a TZif file" โจver(sion): An octet telling you which version of the format the file uses. The value MUST be one of the following:- NUL (
0x00) Version 1: the file only has the version 1 header and data block. Version 1 files MUST NOT contain a version 2+ header, data block, or footer. no extras, bestie ๐ - '2' (
0x32) Version 2: the file MUST contain the version 1 header and data block, a version 2+ header and data block, and a footer. The TZ string in the footer (Section 3.3), if nonempty, MUST strictly adhere to the requirements for the TZ environment variable as defined in Section 8.3 of the "Base Definitions" volume of [POSIX] and MUST encode the POSIX portable character set as ASCII. very strict, very iconic ๐ - '3' (
0x33) Version 3: the file MUST contain the version 1 header and data block, a version 2+ header and data block, and a footer. The TZ string in the footer (Section 3.3), if nonempty, MUST conform to POSIX requirements with ASCII encoding, except that it MAY use the TZ string extensions described below (Section 3.3.1). the glow-up version ๐ฆ
- NUL (
isutcnt: A four-octet unsigned integer that says how many UT/local indicators are in the data block. It MUST either be zero or equal to "typecnt". ๐isstdcnt: A four-octet unsigned integer that says how many standard/wall indicators are in the data block. It MUST either be zero or equal to "typecnt". ๐leapcnt: A four-octet unsigned integer counting the leap-second records in the data block. ๐timecnt: A four-octet unsigned integer counting the transition times in the data block. โญtypecnt: A four-octet unsigned integer counting the local time type records in the data block. It MUST NOT be zero. (Even though local time type records don't give you any useful info in files that have a nonempty TZ string but no transitions, you still need at least one, because lots of TZif readers reject files with zero time types ๐)charcnt: A four-octet unsigned integer for the total number of octets used by the time zone designations in the data block. It MUST NOT be zero. The count includes the trailing NUL (0x00) octet at the end of the last time zone designation. the little NUL at the end is doing the most ๐ญ
Although the version 1 and 2+ headers have the same format, magic number, and version fields, their count fields may differ, because the version 1 data can be a subset of the version 2+ data. so they look like twins but have different counts, iykyk ๐ฏโโ๏ธ๐
3.2. TZif Data Block โจ
okay bestie, the data block is where all the juicy stuff lives ๐ It has seven variable-length elements, and each one is just a series of items. The count for each series comes from the matching count field in the header, and the total length of an element is the number of items times the size of each item ๐งฎ So if you don't want to parse or use the version 1 data block, you can work out its total length and skip straight to the version 2+ header. no cap, that's a whole vibe ๐ฆ
In the version 1 data block, time values are 32 bits (TIME_SIZE = 4 octets) ๐ธ In the version 2+ data block, which only shows up in version 2 and 3 files, time values are 64 bits (TIME_SIZE = 8 octets) ๐
Here's the layout, with the lengths of multi-octet fields in parentheses ๐
+---------------------------------------------------------+
| transition times (timecnt x TIME_SIZE) |
+---------------------------------------------------------+
| transition types (timecnt) |
+---------------------------------------------------------+
| local time type records (typecnt x 6) |
+---------------------------------------------------------+
| time zone designations (charcnt) |
+---------------------------------------------------------+
| leap-second records (leapcnt x (TIME_SIZE + 4)) |
+---------------------------------------------------------+
| standard/wall indicators (isstdcnt) |
+---------------------------------------------------------+
| UT/local indicators (isutcnt) |
+---------------------------------------------------------+
TZif Data Block
Now let's break down each element ๐
- transition times: A series of four- or eight-octet UNIX leap-time values, sorted in strictly ascending order. Each one is a transition time where the rules for working out local time might change ๐ฐ๏ธ The count comes from
timecntin the header. Each time value SHOULD be at least-2**59.
(-2**59 is the greatest negated power of 2 that predates the Big Bang, and steering clear of anything earlier dodges known TZif reader bugs with outlandishly negative timestamps.) ๐
- transition types: A series of one-octet unsigned integers, each one saying which type of local time goes with the matching transition time ๐ These act as zero-based indices into the array of local time type records, and the count comes from
timecntin the header. Each type index MUST be in the range[0, "typecnt" - 1]. - local time type records: A series of six-octet records that each describe a local time type โจ The count comes from
typecntin the header. Each record looks like this (the lengths of multi-octet fields are in parentheses):
+---------------+---+---+
| utoff (4) |dst|idx|
+---------------+---+---+
- utoff: A four-octet signed integer for the number of seconds added to UT to get local time ๐ The value MUST NOT be
-2**31, and it SHOULD be in the range[-89999, 93599](i.e., its value SHOULD be more than -25 hours and less than 26 hours). Avoiding-2**31lets 32-bit clients negate the value without overflow ๐ง Keeping it in[-89999, 93599]makes things easy for implementations that already handle the POSIX-required range[-24:59:59, 25:59:59]. - (is)dst: A one-octet value that says whether the local time counts as Daylight Saving Time (DST) โ๏ธ The value MUST be 0 or 1. A one (1) means DST, and a zero (0) means standard time.
- (desig)idx: A one-octet unsigned integer, a zero-based index into the series of time zone designation octets, which picks out one designation string ๐ท๏ธ Each index MUST be in the range
[0, "charcnt" - 1]. It points at the NUL-terminated string of octets starting at positionidxin the time zone designations. (This string MAY be empty.) A NUL octet MUST exist in the time zone designations at or after positionidx.
- time zone designations: A series of octets forming an array of NUL-terminated (
0x00) time zone designation strings ๐ The total number of octets is in thecharcntfield of the header. Note that two designations MAY overlap if one is a suffix of the other. The character encoding of these strings isn't specified, but check out Section 4 of this document for more on that ๐ - leap-second records: A series of eight- or twelve-octet records that describe the corrections needed to get from UTC to TAI ๐ญ They're sorted by occurrence time in strictly ascending order, and the count comes from
leapcntin the header. Each record has one of these two structures (the lengths of multi-octet fields are in parentheses):
Version 1 Data Block:
+---------------+---------------+
| occur (4) | corr (4) |
+---------------+---------------+
version 2+ Data Block:
+---------------+---------------+---------------+
| occur (8) | corr (4) |
+---------------+---------------+---------------+
- occur(rence): A four- or eight-octet UNIX leap time value for when a leap-second correction happens โฐ The first value, if present, MUST be nonnegative, and each later value MUST be at least 2419199 greater than the previous value. (That's 28 days' worth of seconds, minus a potential negative leap second.)
- corr(ection): A four-octet signed integer for the value of
LEAPCORRon or after the occurrence ๐ซ The correction value in the first leap-second record, if present, MUST be either one (1) or minus one (-1). The correction values in adjacent leap-second records MUST differ by exactly one (1). The value ofLEAPCORRis zero for timestamps before the occurrence time in the first leap-second record (or for all timestamps if there are no leap-second records).
- standard/wall indicators: A series of one-octet values showing whether the transition times for local time types were specified as standard time or wall-clock time ๐งพ Each value MUST be 0 or 1. A one (1) means standard time, and the value MUST be set to one (1) if the matching UT/local indicator is set to one (1). A zero (0) means wall time. The count comes from
isstdcntin the header. Ifisstdcntis zero (0), all transition times for local time types are assumed to be wall time. - UT/local indicators: A series of one-octet values showing whether those transition times were specified as UT or local time ๐ Each value MUST be 0 or 1. A one (1) means UT, and the matching standard/wall indicator MUST also be set to one (1). A zero (0) means local time. The count comes from
isutcntin the header. Ifisutcntis zero (0), all transition times for local time types are assumed to be local time.
The type linked to a transition time gives the local time for timestamps starting at that transition and running up to, but not including, the next one ๐ฉท Timestamps before the first transition use the first time type (time type 0). Timestamps on or after the last transition use the TZ string in the footer (Section 3.3) if it's present and nonempty. Otherwise, it's unspecified. If there are no transitions at all, every timestamp uses the TZ string in the footer if it's present and nonempty. If not, they use time type 0.
Each pair of standard/wall and UT/local indicators tells you whether the matching transition time was specified as UT, standard time, or wall-clock time ๐ฏ There are only three combinations of the two indicators, since the standard/wall value MUST be one (1) whenever the UT/local value is one (1). This is handy if the transition times in a TZif file need to be turned into transitions for a different time zone, like when working out transition times for a simple POSIX TZ string such as "AKST9AKDT".
To keep a TZif file from wasting space, every nonzero local time type index SHOULD appear at least once in the transition type array ๐งน Likewise, every octet in the time zone designations array SHOULD be used by at least one time type record.
3.3. TZif Footer ๐
The TZif footer is structured like this (the lengths of multi-octet fields are in parentheses):
+---+--------------------+---+
| NL| TZ string (0...) |NL |
+---+--------------------+---+
TZif Footer
Here's what the footer pieces mean ๐
- NL: An ASCII new line character (
0x0A) ๐ซถ - TZ string: A rule for working out local time changes after the last transition time stored in the version 2+ data block ๐บ๏ธ The string is either empty or uses the expanded format of the "TZ" environment variable, as defined in Section 8.3 of the "Base Definitions" volume of [POSIX] with ASCII encoding. In version 3 files it may also use the extensions described below (Section 3.3.1). If the string is empty, the matching information isn't available. If the string is nonempty and one or more transitions show up in the version 2+ data, the string MUST be consistent with the last version 2+ transition. In other words, evaluating the TZ string at the time of the last transition should yield the same time type that was specified in that last transition. The string MUST NOT contain NUL octets or be NUL-terminated, and it SHOULD NOT begin with the ':' (colon) character.
The TZif footer is only present in version 2 and 3 files ๐ The obsolescent version 1 format came out before anyone realised a footer was needed.
3.3.1. TZ String Extensions โจ
okay so a version 3 TZif file is allowed to use some extra tricks on top of regular POSIX TZ strings ๐ MAY is the word here, so it's optional, but the rules are described using the terminology from Section 8.3 of the "Base Definitions" volume of [POSIX] ๐
- The hours part of the transition times can be signed and go from -167 through 167 (-167 <= hh <= 167) ๐ POSIX only lets it be unsigned, from 0 through 24, so this is a major glow-up ๐
Example: <-03>3<-02>,M3.5.0/-2,M10.5.0/-1 This one is giving DST from 22:00 on the day before March's last Sunday until 23:00 on the day before October's last Sunday ๐ธ Standard time is 3 hours west of UT and gets abbreviated "-03", and daylight saving time is 2 hours west of UT and gets abbreviated "-02" ๐ฆ
- DST counts as being in effect all year if it starts January 1 at 00:00 and ends December 31 at 24:00 plus the difference between daylight saving and standard time ๐ญ That leaves no room at all for standard time on the calendar, so it's a full DST-forever moment ๐ง
Example: EST5EDT,0/0,J365/25 This is a time zone that observes daylight saving time all year long โ๏ธ It's 4 hours west of UT and gets abbreviated "EDT" ๐
4. Interoperability Considerations โจ
these practices are the secret sauce for making sure TZif apps actually get along ๐ซถ
- Version 1 files are a legacy format, so they SHOULD NOT be generated ๐ They don't support transition times after the year 2038, which is literally the cutoff ๐
- Implementations that only understand version 1 MUST ignore any data that goes past the calculated end of the version 1 data block ๐ซ
- Implementations SHOULD generate a version 3 file if TZ string extensions are necessary to model transition times accurately ๐ฅ Otherwise, version 2 files SHOULD be generated ๐
- The sequence of time changes in the version 1 header and data block SHOULD be a contiguous sub-sequence of the time changes in the version 2+ header and data block, plus the footer ๐ง This helps obsolescent version 1 readers agree with current readers about timestamps inside that contiguous sub-sequence ๐ It also lets writers that don't support obsolescent readers set "timecnt" to zero in the version 1 data block to save space ๐
- Time zone designations SHOULD consist of at least three (3) and no more than six (6) ASCII characters from the set of alphanumerics, '-', and '+' โจ This is for compatibility with POSIX requirements for time zone abbreviations ๐
- When reading a version 2 or 3 file, implementations SHOULD ignore the version 1 header and data block, except for skipping over them ๐ฆ
- Implementations SHOULD calculate the total lengths of the headers and data blocks and check that they all fit within the actual file size, as part of a validity check for the file ๐ซถ
- When a TZif file is used in a MIME message entity, it SHOULD be indicated by one of the following media types ๐
- "application/tzif-leap" (Section 8.2) to indicate that leap-second records are included in the TZif data as necessary (none are necessary if the file is truncated to a range that precedes the first leap second) ๐ธ
- "application/tzif" (Section 8.1) to indicate that leap-second records are not included in the TZif data; "leapcnt" in the header(s) MUST be zero (0) ๐
- Common interoperability issues and possible workarounds are described in Appendix A ๐
5. Use with the Time Zone Data Distribution Service โจ
the Time Zone Data Distribution Service (TZDIST) [RFC7808] is a service that delivers time zone data and leap-second rules reliably, securely, and fast ๐ It's built for client systems like calendaring and scheduling apps or operating systems ๐
A TZDIST service MAY supply time zone data to clients in the Time Zone Information Format ๐ง If it does, it MUST indicate that support by including the media type "application/tzif" (Section 8.1) in its "capabilities" response (see Section 5.1 of [RFC7808]) ๐ A TZDIST service MAY also include "application/tzif-leap" (Section 8.2) in its "capabilities" response if it can generate TZif files containing leap-second records ๐ But a TZDIST service MUST NOT advertise "application/tzif-leap" without also advertising "application/tzif" ๐ โโ๏ธ
TZDIST clients MUST use the HTTP "Accept" [RFC7231] header field to say whether they want data in "application/tzif", "application/tzif-leap", or both ๐
5.1. Truncating TZif Files
as described in Section 3.9 of [RFC7808], a TZDIST service MAY truncate time zone transition data โ๏ธ A truncated TZif file is valid from its first transition time up to, but not including, its last version 2+ transition time, if there is one ๐ฆ
When truncating the start of a TZif file, the service MUST supply a first transition time in the version 2+ data that is the start point of the truncation range ๐ธ Just like with untruncated files, time type 0 means local time right before the start point, and the time type of the first transition means local time after that ๐
When truncating the end of a TZif file, the service MUST supply a last transition time in the version 2+ data that is the end point of the truncation range, and it MUST supply an empty TZ string ๐ญ Just like untruncated TZif files with empty TZ strings, a truncated TZif file doesn't indicate local time after the last transition ๐
All represented information inside the truncation range MUST be the same as the information represented by a corresponding untruncated TZif file ๐ซถ
TZDIST clients SHOULD NOT use a truncated TZif file (as described above) to interpret timestamps outside the truncation time range ๐ซ
5.2. Example TZDIST Request for TZif Data
in this example, the client checks the server for the available formats, then asks for the time zone with a specific time zone identifier in Time Zone Information Format ๐
Note that this example assumes the time zone context path has been discovered (see [RFC7808], Section 4.2.1) to be "/tzdist" ๐ง
>> Request <<
GET /tzdist/capabilities HTTP/1.1
Host: tz.example.com
>> Response <<
HTTP/1.1 200 OK
Date: Fri, 01 Jun 2018 14:52:23 GMT
Content-Type: application/json; charset="utf-8"
Content-Length: xxxx
{
"version": 1,
"info": {
"primary-source": "IANA:2018e",
"formats": [
"text/calendar",
"application/tzif",
"application/tzif-leap"
],
...
},
...
}
>> Request <<
GET /tzdist/zones/America%2FNew_York HTTP/1.1
Host: tz.example.com
Accept: application/tzif
>> Response <<
HTTP/1.1 200 OK
Date: Fri, 01 Jun 2018 14:52:24 GMT
Content-Type: application/tzif
Content-Length: xxxx
ETag: "123456789-000-111"
TZif2...[binary data without leap-second records]...
EST5EDT,M3.2.0,M11.1.0
6. Security Considerations โจ
okay this section is serious, bestie ๐จ The Time Zone Information Format has no executable code, and it doesn't define any extensible areas that could be used to store such code ๐
TZif contains counted arrays of data elements ๐งฎ All counts should be checked when processing TZif objects, so nothing gets read past the end of the object ๐
TZif provides no confidentiality or integrity protection ๐ฌ Time zone information is normally public and doesn't need confidentiality protection ๐ But since time zone information is used in lots of critical applications, integrity protection may be required, and it must be provided externally ๐ก๏ธ
7. Privacy Considerations โจ
the Time Zone Information Format contains publicly available data, and it doesn't define any extensible areas that could be used to store private data ๐ท
as discussed in Section 9 of [RFC7808], sending time zone data over an insecure channel could leak the past, current, or future location of a device or user ๐ So TZif data sent over a public communications channel MUST be protected with a confidentiality layer, such as the one provided by Transport Layer Security (TLS) [RFC8446] ๐
8. IANA Considerations โจ
this document defines two media types [RFC6838] for exchanging data in the Time Zone Information Format ๐ฌ
8.1. application/tzif
Type name: application
Subtype name: tzif
Required parameters: none
Optional parameters: none
Encoding considerations: binary
Security considerations: See Section 6 of RFC 8536.
Interoperability considerations: See Section 4 of RFC 8536.
Published specification: This specification.
Applications that use this media type: This media type is designed
for widespread use by applications that need to use or exchange
time zone information, such as the Time Zone Information Compiler
(zic) [ZIC] and the GNU C Library [GNU-C]. The Time Zone
Distribution Service [RFC7808] can directly use this media type.
Fragment identifier considerations: N/A
Additional information:
Magic number(s): The first 4 octets are 0x54, 0x5A, 0x69, 0x66
File extensions(s): N/A
Macintosh file type code(s): N/A
Person & email address to contact for further information:
Time Zone Database mailing list <tz@iana.org>
Intended usage: COMMON
Restrictions on usage: N/A
Author: See the "Authors' Addresses" section of RFC 8536.
Change controller: IETF
8.2. application/tzif-leap
Type name: application
Subtype name: tzif-leap
Required parameters: none
Optional parameters: none
Encoding considerations: binary
Security considerations: See Section 6 of RFC 8536.
Interoperability considerations: See Section 4 of RFC 8536.
Published specification: This specification.
Applications that use this media type: This media type is designed
for widespread use by applications that need to use or exchange
time zone information, such as the Time Zone Information Compiler
(zic) [ZIC] and the GNU C Library [GNU-C]. The Time Zone
Distribution Service [RFC7808] can directly use this media type.
Fragment identifier considerations: N/A
Additional information:
Magic number(s): The first 4 octets are 0x54, 0x5A, 0x69, 0x66
File extensions(s): N/A
Macintosh file type code(s): N/A
Person & email address to contact for further information:
Time Zone Database mailing list <tz@iana.org>
Intended usage: COMMON
Restrictions on usage: N/A
Author: See the "Authors' Addresses" section of RFC 8536.
Change controller: IETF
9. References โจ
9.1. Normative References
Okay, these are the docs this spec literally can't function without, bestie ๐โจ
- [GNU-C] "The GNU C Library (glibc)", <https://www.gnu.org/software/libc/>.
- [POSIX] IEEE, "Standard for Information Technology--Portable Operating System Interface (POSIX(R)) Base Specifications, Issue 7", IEEE 1003.1-2017, DOI 10.1109/IEEESTD.2018.8277153, January 2018, <http://pubs.opengroup.org/onlinepubs/9699919799/>.
- [RFC20] Cerf, V., "ASCII format for network interchange", STD 80, RFC 20, DOI 10.17487/RFC0020, October 1969, <https://www.rfc-editor.org/info/rfc20>.
- [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <https://www.rfc-editor.org/info/rfc2119>.
- [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type Specifications and Registration Procedures", BCP 13, RFC 6838, DOI 10.17487/RFC6838, January 2013, <https://www.rfc-editor.org/info/rfc6838>.
- [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content", RFC 7231, DOI 10.17487/RFC7231, June 2014, <https://www.rfc-editor.org/info/rfc7231>.
- [RFC7808] Douglass, M. and C. Daboo, "Time Zone Data Distribution Service", RFC 7808, DOI 10.17487/RFC7808, March 2016, <https://www.rfc-editor.org/info/rfc7808>.
- [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, <https://www.rfc-editor.org/info/rfc8174>.
- [ZIC] Kerrisk, M., "ZIC(8)", man-pages release 4.16, February 2010, <http://man7.org/linux/man-pages/man8/zic.8.html>.
9.2. Informative References
These ones are the extra reading, the "ooh tell me more" stuff ๐ง๐
- [EGGERT-TZ] "History for tz", October 2018, <https://github.com/eggert/tz/commits/master/tzfile.5>.
- [RFC5545] Desruisseaux, B., Ed., "Internet Calendaring and Scheduling Core Object Specification (iCalendar)", RFC 5545, DOI 10.17487/RFC5545, September 2009, <https://www.rfc-editor.org/info/rfc5545>.
- [RFC6557] Lear, E. and P. Eggert, "Procedures for Maintaining the Time Zone Database", BCP 175, RFC 6557, DOI 10.17487/RFC6557, February 2012, <https://www.rfc-editor.org/info/rfc6557>.
- [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, <https://www.rfc-editor.org/info/rfc8446>.
- [tz-link] Eggert, P. and A. Olson, "Sources for Time Zone and Daylight Saving Time Data", 2018, <https://www.iana.org/time-zones/repository/tz-link.html>.
Appendix A. Common Interoperability Issues โจ
Okay, this appendix is the "things that trip people up" list ๐ซฃ Most of these are problems with writing TZif files for readers that follow the older versions of this spec [EGGERT-TZ]. The goals here are:
- to help TZif writers output files that avoid common pitfalls in older or buggy TZif readers,
- to help TZif readers avoid common pitfalls when reading files generated by future TZif writers, and
- to help any future specification authors see what sort of problems arise when the TZif format is changed.
When new versions of the TZif format have been defined, the design goal was that a reader can successfully use a TZif file even if the file is of a later TZif version than what the reader was designed for. When full compatibility wasn't achieved, the aim was to limit glitches to rarely used timestamps and to allow simple partial workarounds in writers designed to generate new-version data that's still useful for older-version readers. This section documents these compatibility issues and workarounds, along with other common bugs in readers. ๐
Here are the interoperability problems with TZif, bestie:
- Some readers examine only version 1 data. As a partial workaround, a writer can output as much version 1 data as possible. However, a reader should ignore version 1 data and use version 2+ data, even if the reader's native timestamps have only 32 bits.
- Some readers designed for version 2 might mishandle timestamps after a version 3 file's last transition, because they cannot parse extensions to POSIX in the TZ-like string. As a partial workaround, a writer can output more transitions than necessary, so that only far-future timestamps are mishandled by version 2 readers.
- Some readers designed for version 2 do not support permanent daylight saving time -- e.g., a TZ string
"EST5EDT,0/0,J365/25"denoting permanent Eastern Daylight Time (-04). As a partial workaround, a writer can substitute standard time for the next time zone east -- e.g.,"AST4"for permanent Atlantic Standard Time (-04). ๐ธ - Some readers ignore the footer and instead predict future timestamps from the time type of the last transition. As a partial workaround, a writer can output more transitions than necessary.
- Some readers do not use time type 0 for timestamps before the first transition, in that they infer a time type using a heuristic that does not always select time type 0. As a partial workaround, a writer can output a dummy (no-op) first transition at an early time.
- Some readers mishandle timestamps before the first transition that has a timestamp not less than -231. Readers that support only 32-bit timestamps are likely to be more prone to this problem, for example, when they process 64-bit transitions, only some of which are representable in 32 bits. As a partial workaround, a writer can output a dummy transition at timestamp -231.
- Some readers mishandle a transition if its timestamp has the minimum possible signed 64-bit value. Timestamps less than -2**59 are not recommended. ๐
- Some readers mishandle POSIX-style TZ strings that contain "<" or ">". As a partial workaround, a writer can avoid using '<' or '>' for time zone abbreviations containing only alphabetic characters.
- Many readers mishandle time zone abbreviations that contain non-ASCII characters. These characters are not recommended.
- Some readers may mishandle time zone abbreviations that contain fewer than 3 or more than 6 characters, or that contain ASCII characters other than alphanumerics, '-', and '+'. These abbreviations are not recommended.
- Some readers mishandle TZif files that specify daylight saving time UT offsets that are less than the UT offsets for the corresponding standard time. These readers do not support locations like Ireland, which uses the equivalent of the POSIX TZ string
"IST-1GMT0,M10.5.0,M3.5.0/1", observing standard time (IST, +01) in summer and daylight saving time (GMT, +00) in winter. As a partial workaround, a writer can output data for the equivalent of the POSIX TZ string"GMT0IST,M3.5.0/1,M10.5.0", thus swapping standard and daylight saving time. Although this workaround misidentifies which part of the year uses daylight saving time, it records UT offsets and time zone abbreviations correctly. ๐
Some interoperability problems are reader bugs that are listed here mostly as warnings to developers of readers. Consider this your heads-up, reader devs ๐จ
- Some readers do not support negative timestamps. Developers of distributed applications should keep this in mind if they need to deal with pre-1970 data.
- Some readers mishandle timestamps before the first transition that has a nonnegative timestamp. Readers that do not support negative timestamps are likely to be more prone to this problem.
- Some readers mishandle time zone abbreviations like "-08" that contain '+', '-', or digits.
- Some readers mishandle UT offsets that are out of the traditional range of -12 through +12 hours and so do not support locations like Kiritimati that are outside this range.
- Some readers mishandle UT offsets in the range
[-3599, -1]seconds from UT, because they integer-divide the offset by 3600 to get 0 and then display the hour part as "+00". ๐ญ - Some readers mishandle UT offsets that are not a multiple of one hour, 15 minutes, or 1 minute.
Appendix B. Example TZif Files ๐
The following sections contain annotated hexadecimal dumps of example TZif files.
Note that these examples should only be considered informative. Although the example data entries are current as of the publication date of this document, the data will likely change in the future as leap seconds are added and changes are made to civil time. โฐ
B.1. Version 1 File Representing UTC (with Leap Seconds)
Okay bestie, this is the big hex table ๐ฆ Every row is a field in the file, with its offset, the raw data octets in hex, the record or field name, and what the value means. Let's look at it together ๐
+-------+---------------+------------------+------------------------+
| File | Data Octets | Record Name / | Field Value |
| Offset| (hexadecimal) | Field Name | |
+-------+---------------+------------------+------------------------+
| 000 | 54 5a 69 66 | magic | "TZif" |
| 004 | 00 | version | 0 (1) |
| 005 | 00 00 00 00 | | |
| | 00 00 00 00 | | |
| | 00 00 00 00 | | |
| | 00 00 00 | | |
| 020 | 00 00 00 01 | isutccnt | 1 |
| 024 | 00 00 00 01 | isstdcnt | 1 |
| 028 | 00 00 00 1b | isleapcnt | 27 |
| 032 | 00 00 00 00 | timecnt | 0 |
| 036 | 00 00 00 01 | typecnt | 1 |
| 040 | 00 00 00 04 | charcnt | 4 |
| | | | |
| | | localtimetype[0] | |
| 044 | 00 00 00 00 | utcoff | 00:00 |
| 048 | 00 | isdst | 0 (no) |
| 049 | 00 | desigidx | 0 |
| | | | |
| 050 | 55 54 43 00 | designations[0] | "UTC" |
| | | | |
| | | leapsecond[0] | |
| 054 | 04 b2 58 00 | occurrence | 78796800 |
| | | | (1972-06-30T23:59:60Z) |
| 058 | 00 00 00 01 | correction | 1 |
| | | | |
| | | leapsecond[1] | |
| 062 | 05 a4 ec 01 | occurrence | 94694401 |
| | | | (1972-12-31T23:59:60Z) |
| 066 | 00 00 00 02 | correction | 2 |
| | | | |
| | | leapsecond[2] | |
| 070 | 07 86 1f 82 | occurrence | 126230402 |
| | | | (1973-12-31T23:59:60Z) |
| 074 | 00 00 00 03 | correction | 3 |
| | | | |
| | | leapsecond[3] | |
| 078 | 09 67 53 03 | occurrence | 157766403 |
| | | | (1974-12-31T23:59:60Z) |
| 082 | 00 00 00 04 | correction | 4 |
| | | | |
| | | leapsecond[4] | |
| 086 | 0b 48 86 84 | occurrence | 189302404 |
| | | | (1975-12-31T23:59:60Z) |
| 090 | 00 00 00 05 | correction | 5 |
| | | | |
| | | leapsecond[5] | |
| 094 | 0d 2b 0b 85 | occurrence | 220924805 |
| | | | (1976-12-31T23:59:60Z) |
| 098 | 00 00 00 06 | correction | 6 |
| | | | |
| | | leapsecond[6] | |
| 102 | 0f 0c 3f 06 | occurrence | 252460806 |
| | | | (1977-12-31T23:59:60Z) |
| 106 | 00 00 00 07 | correction | 7 |
| | | | |
| | | leapsecond[7] | |
| 110 | 10 ed 72 87 | occurrence | 283996807 |
| | | | (1978-12-31T23:59:60Z) |
| 114 | 00 00 00 08 | correction | 8 |
| | | | |
| | | leapsecond[8] | |
| 118 | 12 ce a6 08 | occurrence | 315532808 |
| | | | (1979-12-31T23:59:60Z) |
| 122 | 00 00 00 09 | correction | 9 |
| | | | |
| | | leapsecond[9] | |
| 126 | 15 9f ca 89 | occurrence | 362793609 |
| | | | (1981-06-30T23:59:60Z) |
| 130 | 00 00 00 0a | correction | 10 |
| | | | |
| | | leapsecond[10] | |
| 134 | 17 80 fe 0a | occurrence | 394329610 |
| | | | (1982-06-30T23:59:60Z) |
| 138 | 00 00 00 0b | correction | 11 |
| | | | |
| | | leapsecond[11] | |
| 142 | 19 62 31 8b | occurrence | 425865611 |
| | | | (1983-06-30T23:59:60Z) |
| 146 | 00 00 00 0c | correction | 12 |
| | | | |
| | | leapsecond[12] | |
| 150 | 1d 25 ea 0c | occurrence | 489024012 |
| | | | (1985-06-30T23:59:60Z) |
| 154 | 00 00 00 0d | correction | 13 |
| | | | |
| | | leapsecond[13] | |
| 158 | 21 da e5 0d | occurrence | 567993613 |
| | | | (1987-12-31T23:59:60Z) |
| 162 | 00 00 00 0e | correction | 14 |
| | | | |
| | | leapsecond[14] | |
| 166 | 25 9e 9d 8e | occurrence | 631152014 |
| | | | (1989-12-31T23:59:60Z) |
| 170 | 00 00 00 0f | correction | 15 |
| | | | |
| | | leapsecond[15] | |
| 174 | 27 7f d1 0f | occurrence | 662688015 |
| | | | (1990-12-31T23:59:60Z) |
| 178 | 00 00 00 10 | correction | 16 |
| | | | |
| | | leapsecond[16] | |
| 182 | 2a 50 f5 90 | occurrence | 709948816 |
| | | | (1992-06-30T23:59:60Z) |
| 186 | 00 00 00 11 | correction | 17 |
| | | | |
| | | leapsecond[17] | |
| 190 | 2c 32 29 11 | occurrence | 741484817 |
| | | | (1993-06-30T23:59:60Z) |
| 194 | 00 00 00 12 | correction | 18 |
| | | | |
| | | leapsecond[18] | |
| 198 | 2e 13 5c 92 | occurrence | 773020818 |
| | | | (1994-06-30T23:59:60Z) |
| 202 | 00 00 00 13 | correction | 19 |
| | | | |
| | | leapsecond[19] | |
| 206 | 30 e7 24 13 | occurrence | 820454419 |
| | | | (1995-12-31T23:59:60Z) |
| 210 | 00 00 00 14 | correction | 20 |
| | | | |
| | | leapsecond[20] | |
| 214 | 33 b8 48 94 | occurrence | 867715220 |
| | | | (1997-06-30T23:59:60Z) |
| 218 | 00 00 00 15 | correction | 21 |
| | | | |
| | | leapsecond[21] | |
| 222 | 36 8c 10 15 | occurrence | 915148821 |
| | | | (1998-12-31T23:59:60Z) |
| 226 | 00 00 00 16 | correction | 22 |
| | | | |
| | | leapsecond[22] | |
| 230 | 43 b7 1b 96 | occurrence | 1136073622 |
| | | | (2005-12-31T23:59:60Z) |
| 234 | 00 00 00 17 | correction | 23 |
| | | | |
| | | leapsecond[23] | |
| 238 | 49 5c 07 97 | occurrence | 1230768023 |
| | | | (2008-12-31T23:59:60Z) |
| 242 | 00 00 00 18 | correction | 24 |
| | | | |
| | | leapsecond[24] | |
| 246 | 4f ef 93 18 | occurrence | 1341100824 |
| | | | (2012-06-30T23:59:60Z) |
| 250 | 00 00 00 19 | correction | 25 |
| | | | |
| | | leapsecond[25] | |
| 254 | 55 93 2d 99 | occurrence | 1435708825 |
| | | | (2015-06-30T23:59:60Z) |
| 258 | 00 00 00 1a | correction | 26 |
| | | | |
| | | leapsecond[26] | |
| 262 | 58 68 46 9a | occurrence | 1483228826 |
| | | | (2016-12-31T23:59:60Z) |
| 266 | 00 00 00 1b | correction | 27 |
| | | | |
| 270 | 00 | UT/local[0] | 0 (local) |
| | | | |
| 271 | 00 | standard/wall[0] | 0 (wall) |
+-------+---------------+------------------+------------------------+
okay so bestie, let's figure out TAI for 2000-01-01T00:00:00Z (UNIX time = 946684800) ๐ฐ๏ธโจ it's literally just two steps:
- Find the latest leap-second occurrence prior to the time of interest (
leapsecond[21]) and note the correction value (LEAPCORR = 22). ๐ - Add
LEAPCORR + 10to the time of interest to yield TAI of2000-01-01T00:00:32. ๐ฆ
the way that math just works out, no cap ๐ญ๐
B.2. Version 2 File Representing Pacific/Honolulu ๐บ
+--------+--------------+------------------+------------------------+
| File | Hexadecimal | Record Name / | Field Value |
|---|---|---|---|
| Offset | Octets | Field Name |
+--------+--------------+------------------+------------------------+
| 000 | 54 5a 69 66 | magic | "TZif" |
|---|---|---|---|
| 004 | 32 | version | '2' (2) |
| 005 | 00 00 00 00 | ||
| 00 00 00 00 | |||
| 00 00 00 00 | |||
| 00 00 00 | |||
| 020 | 00 00 00 06 | isutccnt | 6 |
| 024 | 00 00 00 06 | isstdcnt | 6 |
| 028 | 00 00 00 00 | isleapcnt | 0 |
| 032 | 00 00 00 07 | timecnt | 7 |
| 036 | 00 00 00 06 | typecnt | 6 |
| 040 | 00 00 00 14 | charcnt | 20 |
| 044 | 80 00 00 00 | trans time[0] | -2147483648 |
| (1901-12-13T20:45:52Z) | |||
| 048 | bb 05 43 48 | trans time[1] | -1157283000 |
| (1933-04-30T12:30:00Z) | |||
| 052 | bb 21 71 58 | trans time[2] | -1155436200 |
| (1933-05-21T21:30:00Z) | |||
| 056 | cb 89 3d c8 | trans time[3] | -880198200 |
| (1942-02-09T12:30:00Z) | |||
| 060 | d2 23 f4 70 | trans time[4] | -769395600 |
| (1945-08-14T23:00:00Z) | |||
| 064 | d2 61 49 38 | trans time[5] | -765376200 |
| (1945-09-30T11:30:00Z) | |||
| 068 | d5 8d 73 48 | trans time[6] | -712150200 |
| (1947-06-08T12:30:00Z) | |||
| 072 | 01 | trans type[0] | 1 |
| 073 | 02 | trans type[1] | 2 |
| 074 | 01 | trans type[2] | 1 |
| 075 | 03 | trans type[3] | 3 |
| 076 | 04 | trans type[4] | 4 |
| 077 | 01 | trans type[5] | 1 |
| 078 | 05 | trans type[6] | 5 |
| localtimetype[0] | |||
| 079 | ff ff 6c 02 | utcoff | -37886 (-10:21:26) |
| 083 | 00 | isdst | 0 (no) |
| 084 | 00 | desigidx | 0 |
| localtimetype[1] | |||
| 085 | ff ff 6c 58 | utcoff | -37800 (-10:30) |
| 089 | 00 | isdst | 0 (no) |
| 090 | 04 | desigidx | 4 |
| localtimetype[2] | |||
| 091 | ff ff 7a 68 | utcoff | -34200 (-09:30) |
| 095 | 01 | isdst | 1 (yes) |
| 096 | 08 | desigidx | 8 |
| localtimetype[3] | |||
| 097 | ff ff 7a 68 | utcoff | -34200 (-09:30) |
| 101 | 01 | isdst | 1 (yes) |
| 102 | 0c | desigidx | 12 |
| localtimetype[4] | |||
| 103 | ff ff 7a 68 | utcoff | -34200 (-09:30) |
| 107 | 01 | isdst | 1 (yes) |
| 108 | 10 | desigidx | 16 |
| localtimetype[5] | |||
| 109 | ff ff 73 60 | utcoff | -36000 (-10:00) |
| 113 | 00 | isdst | 0 (no) |
| 114 | 04 | desigidx | 4 |
| 115 | 4c 4d 54 00 | designations[0] | "LMT" |
| 119 | 48 53 54 00 | designations[4] | "HST" |
| 123 | 48 44 54 00 | designations[8] | "HDT" |
| 127 | 48 57 54 00 | designations[12] | "HWT" |
| 131 | 48 50 54 00 | designations[16] | "HPT" |
| 135 | 00 | UT/local[0] | 1 (UT) |
| 136 | 00 | UT/local[1] | 0 (local) |
| 137 | 00 | UT/local[2] | 0 (local) |
| 138 | 00 | UT/local[3] | 0 (local) |
| 139 | 01 | UT/local[4] | 1 (UT) |
| 140 | 00 | UT/local[5] | 0 (local) |
| 141 | 00 | standard/wall[0] | 1 (standard) |
| 142 | 00 | standard/wall[1] | 0 (wall) |
| 143 | 00 | standard/wall[2] | 0 (wall) |
| 144 | 00 | standard/wall[3] | 0 (wall) |
| 145 | 01 | standard/wall[4] | 1 (standard) |
| 146 | 00 | standard/wall[5] | 0 (wall) |
| 147 | 54 5a 69 66 | magic | "TZif" |
| 151 | 32 | version | '2' (2) |
| 152 | 00 00 00 00 | ||
| 00 00 00 00 | |||
| 00 00 00 00 | |||
| 00 00 00 | |||
| 167 | 00 00 00 06 | isutccnt | 6 |
| 171 | 00 00 00 06 | isstdcnt | 6 |
| 175 | 00 00 00 00 | isleapcnt | 0 |
| 179 | 00 00 00 07 | timecnt | 7 |
| 183 | 00 00 00 06 | typecnt | 6 |
| 187 | 00 00 00 14 | charcnt | 20 |
| 191 | ff ff ff ff | trans time[0] | -2334101314 |
| 74 e0 70 be | (1896-01-13T22:31:26Z) | ||
| 199 | ff ff ff ff | trans time[1] | -1157283000 |
| bb 05 43 48 | (1933-04-30T12:30:00Z) | ||
| 207 | ff ff ff ff | trans time[2] | -1155436200 |
| bb 21 71 58 | (1933-05-21T21:30:00Z) | ||
| 215 | ff ff ff ff | trans time[3] | -880198200 |
| cb 89 3d c8 | (1942-02-09T12:30:00Z) | ||
| 223 | ff ff ff ff | trans time[4] | -769395600 |
| d2 23 f4 70 | (1945-08-14T23:00:00Z) | ||
| 231 | ff ff ff ff | trans time[5] | -765376200 |
| d2 61 49 38 | (1945-09-30T11:30:00Z) | ||
| 239 | ff ff ff ff | trans time[6] | -712150200 |
| d5 8d 73 48 | (1947-06-08T12:30:00Z) | ||
| 247 | 01 | trans type[0] | 1 |
| 248 | 02 | trans type[1] | 2 |
| 249 | 01 | trans type[2] | 1 |
| 250 | 03 | trans type[3] | 3 |
| 251 | 04 | trans type[4] | 4 |
| 252 | 01 | trans type[5] | 1 |
| 253 | 05 | trans type[6] | 5 |
| localtimetype[0] | |||
| 254 | ff ff 6c 02 | utcoff | -37886 (-10:21:26) |
| 258 | 00 | isdst | 0 (no) |
| 259 | 00 | desigidx | 0 |
| localtimetype[1] | |||
| 260 | ff ff 6c 58 | utcoff | -37800 (-10:30) |
| 264 | 00 | isdst | 0 (no) |
| 265 | 04 | desigidx | 4 |
| localtimetype[2] | |||
| 266 | ff ff 7a 68 | utcoff | -34200 (-09:30) |
| 270 | 01 | isdst | 1 (yes) |
| 271 | 08 | desigidx | 8 |
| localtimetype[3] | |||
| 272 | ff ff 7a 68 | utcoff | -34200 (-09:30) |
| 276 | 01 | isdst | 1 (yes) |
| 277 | 0c | desigidx | 12 |
| localtimetype[4] | |||
| 278 | ff ff 7a 68 | utcoff | -34200 (-09:30) |
| 282 | 01 | isdst | 1 (yes) |
| 283 | 10 | desigidx | 16 |
| localtimetype[5] | |||
| 284 | ff ff 73 60 | utcoff | -36000 (-10:00) |
| 288 | 00 | isdst | 0 (no) |
| 289 | 04 | desigidx | 4 |
| 290 | 4c 4d 54 00 | designations[0] | "LMT" |
| 294 | 48 53 54 00 | designations[4] | "HST" |
| 298 | 48 44 54 00 | designations[8] | "HDT" |
| 302 | 48 57 54 00 | designations[12] | "HWT" |
| 306 | 48 50 54 00 | designations[16] | "HPT" |
| 310 | 00 | UT/local[0] | 0 (local) |
| 311 | 00 | UT/local[1] | 0 (local) |
| 312 | 00 | UT/local[2] | 0 (local) |
| 313 | 00 | UT/local[3] | 0 (local) |
| 314 | 01 | UT/local[4] | 1 (UT) |
| 315 | 00 | UT/local[5] | 0 (local) |
| | | | |
| 316 | 00 | standard/wall[0] | 0 (wall) |
| 317 | 00 | standard/wall[1] | 0 (wall) |
| 318 | 00 | standard/wall[2] | 0 (wall) |
| 319 | 00 | standard/wall[3] | 0 (wall) |
| 320 | 01 | standard/wall[4] | 1 (standard) |
| 321 | 00 | standard/wall[5] | 0 (wall) |
| | | | |
| 322 | 0a | NL | '\n' |
| 323 | 48 53 54 31 | TZ string | "HST10" |
| | 30 | | |
| 328 | 0a | NL | '\n' |
+--------+--------------+------------------+------------------------+
Okay, so to figure out the local time in this zone for 1933-05-04T12:00:00Z (UNIX time = -1156939200), you'd do this ๐
:
- Find the latest time transition before your time of interest (trans time[1]). ๐ฐ๏ธ
- Check the matching transition type (trans type[1]) to get the local time type index (2). ๐
- Look at that local time type (localtimetype[2]) to grab the offset from UTC (-09:30), the daylight saving indicator (1 = yes), and the index into the time zone designation strings (8). โจ
- Look up the designation string (designations[8] = "HDT"). ๐
- Add the UTC offset to your time of interest and you get 1933-05-04T02:30:00-09:30 (HDT). ๐ธ
Now for 2019-01-01T00:00:00Z (UNIX time = 1546300800), it's a whole different vibe ๐ญ:
- Find the latest time transition before your time of interest. Spoiler: there isn't one ๐
- Look at the TZ string in the footer ("HST10"). This tells you the designation is "HST" all year round, and the offset to UTC is 10:00. ๐ฆ
- Subtract the UTC offset from your time of interest and you land on 2018-12-31T14:00:00-10:00 (HST). ๐
B.3. Truncated Version 3 File Representing Asia/Jerusalem
Next up is a version 3 file that's been chopped off to start on 2038-01-01T00:00:00Z. It's giving main character energy of a future-proof timezone ๐ง
+--------+--------------+------------------+------------------------+
| File | Hexadecimal | Record Name / | Field Value |
| Offset | Octets | Field Name | |
+--------+--------------+------------------+------------------------+
| 000 | 54 5a 69 66 | magic | "TZif" |
| 004 | 33 | version | '3' (3) |
| 005 | 00 00 00 00 | | |
| | 00 00 00 00 | | |
| | 00 00 00 00 | | |
| | 00 00 00 | | |
| 020 | 00 00 00 00 | isutccnt | 0 |
| 024 | 00 00 00 00 | isstdcnt | 0 |
| 028 | 00 00 00 00 | isleapcnt | 0 |
| 032 | 00 00 00 00 | timecnt | 0 |
| 036 | 00 00 00 00 | typecnt | 0 |
| 040 | 00 00 00 00 | charcnt | 0 |
| | | | |
| 044 | 54 5a 69 66 | magic | "TZif" |
| 048 | 33 | version | '3' (3) |
| 049 | 00 00 00 00 | | |
| | 00 00 00 00 | | |
| | 00 00 00 00 | | |
| | 00 00 00 | | |
| 064 | 00 00 00 03 | isutccnt | 1 |
| 068 | 00 00 00 03 | isstdcnt | 1 |
| 072 | 00 00 00 00 | isleapcnt | 0 |
| 076 | 00 00 00 03 | timecnt | 1 |
| 080 | 00 00 00 03 | typecnt | 1 |
| 084 | 00 00 00 08 | charcnt | 4 |
| | | | |
| 088 | 00 00 00 00 | trans time[0] | 2145916800 |
| | 7f e8 17 80 | | (2038-01-01T00:00:00Z) |
| | | | |
| 096 | 00 | trans type[0] | 0 |
| | | | |
| | | localtimetype[0] | |
| 097 | 00 00 1c 20 | utcoff | 7200 (+02:00) |
| 101 | 00 | isdst | 0 (no) |
| 102 | 00 | desigidx | 0 |
| | | | |
| 103 | 49 53 54 00 | designations[0] | "IST" |
| | | | |
| 107 | 01 | UT/local[0] | 1 (UT) |
| | | | |
| 108 | 01 | standard/wall[0] | 1 (standard) |
| | | | |
| 109 | 0a | NL | '\n' |
| 110 | 49 53 54 2d | TZ string | "IST-2IDT, |
| | 32 49 44 54 | | M3.4.4/26,M10.5.0" |
| | 2c 4d 33 2e | | |
| | 34 2e 34 2f | | |
| | 32 36 2c 4d | | |
| | 31 30 2e 35 | | |
| | 2e 30 | | |
| 136 | 0a | NL | '\n' |
+--------+--------------+------------------+------------------------+
Acknowledgments
Huge thanks to these legends for contributing their ideas and support while the authors were writing this spec: Michael Douglass, Ned Freed, Guy Harris, Eliot Lear, and Alexey Melnikov. ๐ซถ๐
Authors' Addresses
Arthur David Olson
Email: arthurdavidolson@gmail.com
Paul Eggert University of California, Los Angeles
Email: eggert@cs.ucla.edu
Kenneth Murchison FastMail US LLC
Email: murch@fastmailteam.com
That's the whole thing, bestie! ๐ The authors are right there if you want to say hi. โจ
๐ฆ where this page comes from
- ietf: rfc8536 2019-02
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms