Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asia/Kuala_Lumpur seems to have disappeared from #all_country_zones (tzinfo 2.0.6, Debian 11) #156

Closed
ndbroadbent opened this issue Feb 13, 2024 · 1 comment

Comments

@ndbroadbent
Copy link

ndbroadbent commented Feb 13, 2024

I recently rebuilt my Debian Docker images using the latest release of 11 (bullseye):

Distributor ID:	Debian
Description:	Debian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye

I have some Ruby code that calls:

TIMEZONES = TZInfo::Timezone.all_country_zones.map(&:name).sort.freeze

This list used to include Asia/Kuala_Lumpur, but this is now missing from all_country_zones.

I don't have the tzinfo-data gem installed, so I believe tzinfo is getting these timezones from the filesystem. I checked the /usr/share/zoneinfo/Asia/ directory in my container, and Kuala_Lumpur is still present in there.

# ls /usr/share/zoneinfo/Asia/
Aden    Aqtobe     Bahrain  Bishkek     Chongqing  Dhaka      Gaza         Hovd      Jerusalem  Kathmandu    Kuala_Lumpur  Magadan   Novokuznetsk  Pontianak  Rangoon    Seoul          Tashkent  Thimphu        Ulan_Bator   Yakutsk
Almaty  Ashgabat   Baku     Brunei      Chungking  Dili       Harbin       Irkutsk   Kabul      Katmandu     Kuching       Makassar  Novosibirsk   Pyongyang  Riyadh     Shanghai       Tbilisi   Tokyo          Urumqi       Yangon
Amman   Ashkhabad  Bangkok  Calcutta    Colombo    Dubai      Hebron       Istanbul  Kamchatka  Khandyga     Kuwait        Manila    Omsk          Qatar      Saigon     Singapore      Tehran    Tomsk          Ust-Nera     Yekaterinburg
Anadyr  Atyrau     Barnaul  Chita       Dacca      Dushanbe   Ho_Chi_Minh  Jakarta   Karachi    Kolkata      Macao         Muscat    Oral          Qostanay   Sakhalin   Srednekolymsk  Tel_Aviv  Ujung_Pandang  Vientiane    Yerevan
Aqtau   Baghdad    Beirut   Choibalsan  Damascus   Famagusta  Hong_Kong    Jayapura  Kashgar    Krasnoyarsk  Macau         Nicosia   Phnom_Penh    Qyzylorda  Samarkand  Taipei         Thimbu    Ulaanbaatar    Vladivostok

But when I run this:

bundle exec ruby -r tzinfo  -e "puts TZInfo::Timezone.all_country_zones.map(&:name)" | sort

The output is missing Kuala_Lumpur, and probably a few others that I haven't noticed. Although most of the timezones still seem to be present:

...
Asia/Jayapura
Asia/Jerusalem
Asia/Kabul
Asia/Kamchatka
Asia/Karachi
Asia/Kathmandu
Asia/Khandyga
Asia/Kolkata
Asia/Krasnoyarsk
Asia/Kuching
Asia/Macau
Asia/Magadan
Asia/Makassar
Asia/Manila
Asia/Nicosia
Asia/Novokuznetsk
Asia/Novosibirsk
Asia/Omsk
Asia/Oral
...

I looked at the #all_country_zones method: https://github.com/tzinfo/tzinfo/blob/5fc278676efde3c85a788fa85ddabddcd91b846f/lib/tzinfo/timezone.rb#L206C7-L208C10

So I ran another experiment based on the code in that method:

bundle exec ruby -r tzinfo  -e "puts TZInfo::Country.all.map {|c| [c.name, c.zones.map(&:name)].join(', ') }" | sort
...
Libya, Africa/Tripoli
Liechtenstein, Europe/Zurich
Lithuania, Europe/Vilnius
Luxembourg, Europe/Brussels
Macau, Asia/Macau
Madagascar, Africa/Nairobi
Malawi, Africa/Maputo
Malaysia, Asia/Kuching, Asia/Singapore
Maldives, Indian/Maldives
Mali, Africa/Abidjan
Malta, Europe/Malta
Marshall Islands, Pacific/Kwajalein, Pacific/Tarawa
Martinique, America/Martinique
...

It looks like Malaysia only has the Asia/Kuching and Asia/Singapore timezones, and is missing Asia/Kuala_Lumpur. I also noticed that Cambodia only returns Asia/Bangkok, so Asia/Phnom_Penh is also missing.

@philr
Copy link
Member

philr commented Feb 13, 2024

When not using tzinfo-data, the data related to time zones of a country (as returned by Timezone#all_country_zones and Country#zones) is taken from the zone1970.tab file in the zoneinfo directory (or zone.tab if zone1970.tab is not found). tzinfo-data also includes data from the same file supplied in IANA Time Zone Database releases.

The contents of the /usr/share/zoneinfo directory on Debian are supplied by the tzdata package. The latest version for Debian 11 is currently 2024a-0+deb11u1. The zone1970.tab file in that version lists the following time zones for Malaysia (country code MY) and Cambodia (KH):

#country-codes  coordinates  TZ              comments
MY,BN           +0133+11020  Asia/Kuching    Sabah, Sarawak
SG,MY           +0117+10351  Asia/Singapore  peninsular Malaysia
TH,CX,KH,LA,VN  +1345+10031  Asia/Bangkok    north Vietnam

This matches the tzinfo output. Debian's zone1970.tab file is also identical to that included in the (currently latest) 2024a release of the IANA Time Zone Database.

The database considers the Asia/Kuala_Lumpur time zone to be identical to Asia/Singapore and Asia/Phnom_Penh to be identical to Asia/Bangkok. The Asia/Kuala_Lumpur and Asia/Phnom_Penh names are included for backwards compatibility. The zone1970.tab file only lists the canonical names.

Note that time zone names are not intended for use by end users. The Time Zone Database documentation includes an explanation of the naming theory.

@philr philr closed this as not planned Won't fix, can't repro, duplicate, stale Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants