class TZInfo::DataSources::ZoneinfoDataSource

A DataSource implementation that loads data from a ‘zoneinfo’ directory containing compiled “TZif” version 3 (or earlier) files in addition to iso3166.tab and zone1970.tab or zone.tab index files.

To have TZInfo load the system zoneinfo files, call {TZInfo::DataSource.set} as follows:

TZInfo::DataSource.set(:zoneinfo)

To load zoneinfo files from a particular directory, pass the directory to {TZInfo::DataSource.set}:

TZInfo::DataSource.set(:zoneinfo, directory)

To load zoneinfo files from a particular directory, but load the iso3166.tab index file from a separate location, pass the directory and path to the iso3166.tab file to {TZInfo::DataSource.set}:

TZInfo::DataSource.set(:zoneinfo, directory, iso3166_path)

Please note that versions of the ‘zic’ tool (used to build zoneinfo files) that were released prior to February 2006 created zoneinfo files that used 32-bit integers for transition timestamps. Later versions of zic produce zoneinfo files that use 64-bit integers. If you have 32-bit zoneinfo files on your system, then any queries falling outside of the range 1901-12-13 20:45:52 to 2038-01-19 03:14:07 may be inaccurate.

Most modern platforms include 64-bit zoneinfo files. However, Mac OS X (up to at least 10.8.4) still uses 32-bit zoneinfo files.

To check whether your zoneinfo files contain 32-bit or 64-bit transition data, you can run the following code (substituting the identifier of the zone you want to test for ‘zone_identifier`):

TZInfo::DataSource.set(:zoneinfo)
dir = TZInfo::DataSource.get.zoneinfo_dir
File.open(File.join(dir, zone_identifier), 'r') {|f| f.read(5) }

If the last line returns ‘“TZif\x00”`, then you have a 32-bit zoneinfo file. If it returns `“TZif2”` or `“TZif3”` then you have a 64-bit zoneinfo file.

It is also worth noting that as of the 2017c release of the IANA Time Zone Database, 64-bit zoneinfo files only include future transitions up to 2038-01-19 03:14:07. Any queries falling after this time may be inaccurate.