Why is zone.tab missing so many time zones

timezone

There are over a thousand time zone files on your typical *nix box (in /user/share/zoneinfo). Many of them vary only in historical dates which have little relevance for programs which care only about recent dates – or even only about the current time. But regardless, there are a ton of them, and it's perfectly legal to select any of them as the time zone for your system as well as to use any of them for a specific program or shell by setting the TZ environment variable. They're all valid.

And then there's the zone.tab file (/usr/share/zoneinfo/zone.tab). It lists only a bit over 400 time zones (414 on my system). It's missing a lot of time zones. So, the question is why? Why aren't they all in there? And since they aren't all in there, how is it decided which ones get put in there?

zone.tab does include a country code and as well as longitude and latitude for each time zone that it lists (which presumably is the reason for the file's existence), and not all time zones really have those (e.g. UTC doesn't have those, and it's not in zone.tab), so clearly, not every time zone can be listed in zone.tab. But why aren't all of the ones which correspond to an actual city or region (as most of them do) listed in the file? Why only 414 instead of the 1000+ which are actually available?

Best Answer

A thread titled A renewed plea for inclusion of zone.tab offers some explanation of what zone.tab is used for.

Its main use seems to be to show a map of cities and their locations, to allow a user to pick their timezone by clicking on a city near them.

With that in mind, it doesn't need to know all of the aliases for each city, knowing one preferred way of referring to it is sufficient. (But it looks like it always includes at least one city in each country.)

The other aliases for each zone are stored in the tzdata source code.

For example, the backward file has

Link    Asia/Kolkata        Asia/Calcutta

so that people can use the new spelling or the old spelling.

All the other files in /usr/share/zoneinfo are generated from this source code using zic.

But there's not 600+ aliases, so why the big difference?

There's usually three versions of each timezone generated: posix, right, and your system's default.

$ cd /usr/share/zoneinfo
$ find right -type f | wc -l
581
$ find posix -type f | wc -l
581
$ find . \( -name posix -o -name right \) -prune -o -type f | wc -l
586

The tzcode Makefile shows how those are generated, and mentions the reason for them: posix ignores leap seconds, right includes them.

See also:

Related Question