floraison / et-orbi

Time zones for fugit and rufus-scheduler. Urbi et Orbi.
MIT License
24 stars 11 forks source link

More missing US time zone aliases and correct Mountain Standard Time #19

Closed vais closed 5 years ago

vais commented 5 years ago

Sorry I didn't catch this problem until after the 1.2 release :(

jmettraux commented 5 years ago

@vais Thanks a lot, I will merge and release 1.2.1.

Do you have a list of those Windows timezones? It seems the ones from https://github.com/floraison/et-orbi/blob/c5b8a669555a994f8b78fe6d0b779cd493543ce1/lib/et-orbi/zones.rb#L244-L246 are incomplete then.

vais commented 5 years ago

@jmettraux it's not that they are incomplete, it's more like the approach currently used seems to be fundamentally flawed, unfortunately, - i.e. using Time#zone which returns a human-readable description of a time zone as a key into the ZONE_ALIASES lookup table.

The reason it's flawed is because there does not seem to be any guarantees as to what these time zone descriptions will be on any given machine/windows version/international locale combination. These descriptions are stored in the Windows registry (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones), and, at least judging by this, they would even be localized according to the current user default UI language (but I have not actually tried this).

I've only done very limited research on this, and I'm in no way an expert on the subject, but here is what I've got so far: it looks like Ruby on Windows uses (here) GetTimeZoneInformation function, which uses the TIME_ZONE_INFORMATION structure, which brings us to the remarks regarding time zone descriptions being stored in the Windows registry, etc.

jmettraux commented 5 years ago

@vais Thanks a ton!

vais commented 5 years ago

No, @jmettraux, thank you for rufus-scheduler! ❤️