Format for Zoneinfo’s Binary Files

Version 1, sizeof long == 4, big endian, packed on arbitrary byte boundaries
Type Name Use
char[4] header always "TZif"
char version '\0' or '2'
char[15] [future use] all '\0'
long tzh_ttisgmtcnt count of UTC/local indicators
long tzh_ttisstdcnt count of standard/wall indicators
long tzh_leapcnt count of leap seconds
long tzh_timecnt count of transition times
long tzh_typecnt count of local time types (never zero)
long tzh_charcnt total characters in all abbreviation strings
long[tzh_timecnt] transition times as returned by time()
unsigned char[tzh_timecnt] indices into following ttinfo array
struct ttinfo {
  long          tt_gmtoff;
  char          tt_isdst;
  unsigned char tt_abbrind;
} [tzh_typecnt]
tt_gmtoff is total ISO 8601 offset (std + dst)
tt_isdst is boolean indicating DST
tt_abbrind is index to abbreviations
char[tzh_charcnt] packed '\0'-terminated abbreviations
long[tzh_leapcnt][2] [][0] is time() at a leap second
[][1] is count of leap seconds after time()
char[tzh_ttisstdcnt] whether local transitions are standard or wall
char[tzh_ttisgmtcnt] whether local transitions are UTC or local
Version 2, additional copy of all the above, but with sizeof long == 8, plus:
char[] "\n" POSIX TZ environment variable "\n"