<html>
<head><title>Zoneinfo Binary Format</title></head>
<body>
<center>
<h2>Format for Zoneinfo&rsquo;s Binary Files</h2>
<table border>
<tr><th colspan=3>Version 1,<tt> sizeof long == 4</tt>, big endian, packed on arbitrary byte boundaries
<tr>
<th>Type</th>
<th>Name</th>
<th>Use</th>
</tr>
<tr align=center>
<td><tt>char[4]</tt></td>
<td>header</td>
<td align=left>always <tt>"TZif"</tt></td>
</tr>
<tr align=center>
<td><tt>char</tt></td>
<td>version</td>
<td align=left><tt>'\0'</tt> or <tt>'2'</tt></td>
</tr>
<tr align=center>
<td><tt>char[15]</tt></td>
<td>[future use]</td>
<td align=left>all <tt>'\0'</tt></td>
</tr>
<tr align=center>
<td><tt>long</tt></td>
<td><tt>tzh_ttisgmtcnt</tt></td>
<td align=left>count of UTC/local indicators</td>
</tr>
<tr align=center>
<td><tt>long</tt></td>
<td><tt>tzh_ttisstdcnt</tt></td>
<td align=left>count of standard/wall indicators</td>
</tr>
<tr align=center>
<td><tt>long</tt></td>
<td><tt>tzh_leapcnt</tt></td>
<td align=left>count of leap seconds</td>
</tr>
<tr align=center>
<td><tt>long</tt></td>
<td><tt>tzh_timecnt</tt></td>
<td align=left>count of transition times</td>
</tr>
<tr align=center>
<td><tt>long</tt></td>
<td><tt>tzh_typecnt</tt></td>
<td align=left>count of local time types (never zero)</td>
</tr>
<tr align=center>
<td><tt>long</tt></td>
<td><tt>tzh_charcnt</tt></td>
<td align=left>total characters in all abbreviation strings</td>
</tr>
<tr align=center>
<td><tt>long[tzh_timecnt]</tt></td>
<td rowspan=7>&ndash;</td>
<td align=left>transition times as returned by <nobr><tt>time()</tt></nobr></td>
</tr>
<tr align=center>
<td><tt>unsigned char[tzh_timecnt]</tt></td>
<td align=left>indices into following <tt>ttinfo</tt> array</td>
</tr>
<tr align=center>
<td align=left>
<tt>struct ttinfo {<br>
&nbsp;&nbsp;long&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tt_gmtoff;<br>
&nbsp;&nbsp;char&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tt_isdst;<br>
&nbsp;&nbsp;unsigned char tt_abbrind;<br>
} [tzh_typecnt]</tt>
</td>
<td align=left>
  <tt>tt_gmtoff</tt> is total ISO 8601 offset (std + dst)<br>
  <tt>tt_isdst</tt> is boolean indicating DST<br>
  <tt>tt_abbrind</tt> is index to abbreviations
</td>
</tr>
<tr align=center>
<td><tt>char[tzh_charcnt]</tt></td>
<td align=left>packed <tt>'\0'</tt>-terminated abbreviations
</tr>
<tr align=center>
<td><tt>long[tzh_leapcnt][2]</tt></td>
<td align=left>
  <tt>[][0]</tt> is <nobr><tt>time()</tt></nobr> at a leap second<br>
  <tt>[][1]</tt> is count of leap seconds after <nobr><tt>time()</tt></nobr>
</td>
</tr>
<tr align=center>
<td><tt>char[tzh_ttisstdcnt]</tt></td>
<td align=left>whether local transitions are standard or wall</td>
</tr>
<tr align=center>
<td><tt>char[tzh_ttisgmtcnt]</tt></td>
<td align=left>whether local transitions are UTC or local</td>
</tr>
<tr bgcolor=lightgrey>
  <th colspan=3>Version 2, additional copy of all the above, but with<tt> sizeof long == 8</tt>, plus:</th>
</tr>
<tr align=center bgcolor=lightgrey>
<td><tt>char[]</tt></td>
<td>&ndash;</td>
<td align=left><tt>"\n"</tt> <i><tt>POSIX</tt> <tt>TZ</tt> environment variable</i> <tt>"\n"</tt></td>
</tr>
</table>
</center>
</body>
</html>