tzfile.5: Add various details on version 2 format

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Sam Varshavchik 2015-05-02 09:54:33 +02:00 committed by Michael Kerrisk
parent ea735ea85e
commit f09abf6d41
1 changed files with 69 additions and 3 deletions

View File

@ -20,7 +20,7 @@ Timezone information files
begin with the magic characters "TZif" to identify them as
timezone information files,
followed by a character identifying the version of the file's format
(as of 2005, either an ASCII NUL (\(aq\\0\(aq) or a \(aq2\(aq)
(as of 2005, either an ASCII NUL (\(aq\\0\(aq) or a \(aq2\(aq (\fB0x32\fP))
followed by fifteen bytes containing zeros reserved for future use,
followed by six four-byte values of type
.IR long ,
@ -144,16 +144,82 @@ if either
.I tzh_timecnt
is zero or the time argument is less than the first transition time recorded
in the file.
.PP
.SS Version 2 format
For version-2-format timezone files,
the above header and data is followed by a second header and data,
identical in format except that
eight bytes are used for each transition time or leap-second time.
eight bytes are used for each transition time or leap-second time
(and that the version byte in the header record is
\fB0x32\fP rather than \fB0x00\fP).
After the second header and data comes a newline-enclosed,
POSIX-TZ-environment-variable-style string for use in handling instants
after the last transition time stored in the file
(with nothing between the newlines if there is no POSIX representation for
such instants).
.PP
The second section of the timezone file consists of another 44-byte header
record, identical in structure to the one at the beginning of the file,
except that it applies to the data that follows,
which is also identical in structure
to the first section of the timezone file, with the following differences:
.IP * 3
The transition time values, after the header, are eight-byte values.
.IP *
In each leap second record, the leap second value is an eight-byte value.
The accumulated leap second count is still a four-byte value.
.PP
In all cases, the eight-byte time values are given in
the "standard" byte order,
the high-order byte first.
.SS POSIX timezone string
The second eight-byte time value section is followed by an optional
third section:
a single ASCII newline character (\(aq\\n\(aq),
then a text string followed by a second
newline character.
The text string is a POSIX timezone string, whose format is described in the
.BR tzset (3)
manual page.
.PP
The POSIX timezone string defines a rule for computing transition times
that follow the last transition time explicitly specified in the timezone
information file.
.SS Summary of the timezone information file format
\&
.sp 2
.RS
.nf
Four-byte value section
(header version \fB0x00\fP or \fB0x32\fP)
Header record
Four-byte transition times
Transition time index
\fBttinfo\fP structures
Timezone abbreviation array
Leap second records
Standard/Wall array
UTC/Local array
Eight-byte value section
(only if first header version is \fB0x32\fP,
the second header's version is also \fB0x32\fP)
Header record
Eight-byte transition times
Transition time index
\fBttinfo\fP structures
Timezone abbreviation array
Leap second records
Standard/Wall array
UTC/Local array
Third section
(optional, only in \fB0x32\fP version files)
Newline character
Timezone string
Newline character
.fi
.RE
.SH SEE ALSO
.BR ctime (3),
.BR tzset (3),