Independent Submission | A. Olson |
Internet-Draft | |
Updates: 7808 (if approved) | P. Eggert |
Intended status: Standards Track | UCLA |
Expires: November 24, 2018 | K. Murchison |
FastMail | |
May 23, 2018 |
The Time Zone Information Format (TZif)
draft-murchison-tzdist-tzif-01
This document defines the Time Zone Information File Format for representing and exchanging time zone information, independent of any particular service or protocol. A MIME media type for this format is also defined.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on November 24, 2018.
Copyright (c) 2018 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document.
Time zone data typically consists of an offset from Universal Coordinated Time (UTC), daylight saving transition rules, one or more local time designations (acronyms or abbreviations), and optional leap second adjustments. One such format for conveying this information is iCalendar. It is a text-based format used by calendaring and scheduling systems.
This document defines the Time Zone Information Format. It is a binary format used by most UNIX systems to calculate local time. There is a wide variety of interoperable software capable of generating and reading files in this format.
This specification does not define the source of the time zone data or leap second information. It is assumed that a reliable and accurate source is available. One such source is the IANA-hosted time zone database [RFC6557].
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.
The following terms are used in this document:
The time zone information format begins with a fixed 44-octet header followed by a variable-length data block using four-octet (32-bit) transition times and leap second occurrences. These 32-bit values are limited to representing times no later than 19 January, 2038 03:14:07 UTC.
The TZif header contains a field which specifies the version of the file's format. Version 1 files terminate after the 32-bit data block.
Version 2 and 3 files extend the format by appending a second 44-octet header, another variable-length data block using eight-octet (64-bit) transition times and leap second occurrences, and a variable length footer. These 64-bit values can represent times approximately 292 billion years into the future.
A TZif file is structured as follows:
Version 1 Versions 2 & 3 +-------------+ +-------------+ | Header for | | Header for | | 32-bit | | 32-bit | | Transitions | | Transitions | +-------------+ +-------------+ | Data with | | Data with | | 32-bit | | 32-bit | | Transitions | | Transitions | +-------------+ +-------------+ | Header for | | 64-bit | | Transitions | +-------------+ | Data with | | 64-bit | | Transitions | +-------------+ | Footer | +-------------+
General Format of TZif Files
Version 1 files are considered a legacy format and SHOULD NOT be generated, as they do not support transition times after the year 2038.
Implementations SHOULD generate version 2 or 3 files, and SHOULD strive to make the pre-2038 transition times in the 32-bit and 64-bit data blocks consistent with one another.
NOTE: All multi-octet integer values MUST be stored in network byte order format (high-order octet first, otherwise known as big-endian).
The TZif header is structured as follows (the number of octets occupied by a field is shown in parenthesis):
+---------------+---+ | magic (4) |ver| +---------------+---+---------------------------------------+ | [unused - reserved for future use] (15) | +---------------+---------------+---------------+-----------+ | isutccnt (4) | isstdcnt (4) | leapcnt (4) | +---------------+---------------+---------------+ | timecnt (4) | typecnt (4) | charcnt (4) | +---------------+---------------+---------------+
TZif Header
The fields of the header are defined as follows:
The TZif data block consists of seven variable-length elements, each of which is series of zero or more items. The number of items in each series is determined by the corresponding count field in the header. The total length of each element is calculated by multiplying the number of items by the size of each item. Therefore, implementations that do not wish to parse and/or use the 32-bit data block can calculate its total length and skip directly to the header of the 64-bit data block.
In the initial data block, time values are 32-bit (TIME_SIZE = 4 octets). In the second data block, present only in version 2 and 3 files, times values are 64-bit (TIME_SIZE = 8 octets).
The data block is structured as follows (the number of octets occupied by a field is shown in parenthesis):
+---------------------------------------------------------+ | transition times (timecnt x TIME_SIZE) | +---------------------------------------------------------+ | transition time index (timecnt) | +---------------------------------------------------------+ | local time type records (typecnt x 6) | +---------------------------------------------------------+ | time zone designations (charcnt) | +---------------------------------------------------------+ | leap second records (leapcnt x (TIME_SIZE + 4)) | +---------------------------------------------------------+ | standard/wall indicators (isstdcnt) | +---------------------------------------------------------+ | UTC/local indicators (isutccnt) | +---------------------------------------------------------+
TZif Data Block
The elements of the data block are defined as follows:
+---------------+-+-+---+ | utcoff (4) |dst|idx| +---------------+---+---+
+---------------+---------------+ | epoch (4) | corr (4) | +---------------+---------------+
+---------------+---------------+---------------+ | epoch (8) | corr (4) | +---------------+---------------+---------------+
The TZif footer is structured as follows (the number of octets occupied by a field is shown in parenthesis):
+---+--------------------------+---+ | NL| POSIX TZ string (0...) |NL | +---+--------------------------+---+
TZif Footer
The elements of the footer are defined as follows:
The Time Zone Data Distribution Service (TZDIST) is a service that allows reliable, secure, and fast delivery of time zone data and leap second rules to client systems such as calendaring and scheduling applications or operating systems.
A TZDIST service MAY supply time zone data to clients in the Time Zone Information Format. Such a service MUST indicate that it supports this format by including the MIME media type "application/tzif" in its "capabilities" response (see Section 5.1 of [RFC7808].
TZDIST clients MUST use the HTTP "Accept" header field to indicate their preference to receive data in the "application/tzif" format.
In this example, the client checks the server for the available formats and then requests that the time zone with a specific time zone identifer be returned in Time Zone Information Format.
Note that this example presumes that 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: Wed, 22 Nov 2017 09:32:12 GMT Content-Type: application/json; charset="utf-8" Content-Length: xxxx { "version": 1, "info": { "primary-source": "IANA:2017c", "formats": [ "text/calendar", "application/tzif", ], ... }, ... } >> Request << GET /tzdist/zones/America%2FNew_York HTTP/1.1 Host: tz.example.com Accept: application/tzif >> Response << HTTP/1.1 200 OK Date: Wed, 22 Nov 2017 09:32:12 GMT Content-Type: application/tzif Content-Length: xxxx ETag: "123456789-000-111" TZif2...[binary data]... EST5EDT,M3.2.0,M11.1.0
None.
None.
This document defines a MIME media type for the exchange of data utilizing the Time Zone Information Format.
[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. This is identical to The Open Group Base Specifications Issue 7, 2018 edition. |
[RFC2119] | Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997. |
[RFC6838] | Freed, N., Klensin, J. and T. Hansen, "Media Type Specifications and Registration Procedures", BCP 13, RFC 6838, DOI 10.17487/RFC6838, January 2013. |
[RFC7231] | Fielding, R. and J. Reschke, "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content", RFC 7231, DOI 10.17487/RFC7231, June 2014. |
[RFC7808] | Douglass, M. and C. Daboo, "Time Zone Data Distribution Service", RFC 7808, DOI 10.17487/RFC7808, March 2016. |
[RFC8174] | Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017. |
[RFC5545] | Desruisseaux, B., "Internet Calendaring and Scheduling Core Object Specification (iCalendar)", RFC 5545, DOI 10.17487/RFC5545, September 2009. |
[RFC6557] | Lear, E. and P. Eggert, "Procedures for Maintaining the Time Zone Database", BCP 175, RFC 6557, DOI 10.17487/RFC6557, February 2012. |
[tz-link] | Eggert, P. and A. Olson, "Sources for Time Zone and Daylight Saving Time Data", 2018. |
Changes since -00: