Windows timezone display?

The entire time zone in Windows is displayed as

(GMT+10:00) Canberra, Melbourne, Sydney ,

GMT and offset and place. Linux, in turn, has each time zone as a directory mapping in / usr / share / zoneinfo / [Continent] / [Place].

I need to map each Windows timezone to the Linux timezone for my application. as

 (GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi => Asia/Calcutta 

Now surface problems for

+7
source share
3 answers

Unicode.org hosts the mapping as part of the CLDR. You can go to the latest version here . There are also XML versions of the data associated with this page.

You can find sample code (in Python) on how to create a mapping from XML data here .

Mandatory time zone:

Note that the one who implemented timezone support on Windows was on drugs. I am not kidding. Look at the names of time zones. Why Central European Time is called "Romance Standard Time". Romance? What, because it includes Paris, or? Roman standard time could make sense; it also includes Rome, but romance !?

In addition, in the registry, time intervals are not organized under their identifier. No, they are insanely organized under their show! Since this is localized, this means that each time zone will be under a different key in different Windows translations !!! To find the correct time zone, you need to look at the entire time zone to see which has the correct identifier.

I have some sample code for this here . See the get_win_timezone() function.

I wonder if the same guy who designed this decided that POSIX should cancel the sign on time zones, so -8 hours means plus 8 hours. In any case, I am sure that they smoked something illegal together.

+20
source

The definitions in the Etc directory should be POSIX-style, so they have their own sign, canceled from what you expect. I am not an expert for POSIX, but as I understand it, the main idea was to express timzones by combining their local name and GMT offset. Example for Central Europe (Central European Time / CET):

 Europe/Berlin (w/o daylight savings) equals GMT+01:00 equals CET-1 

GMT-1 in the Etc directory actually describes a (fictitious) time zone called "GMT", which is an hour ahead (real) GMT.

As far as I know, these files are only available where you can create (symbolic) links to them, so if you were somewhere in Central Europe you would create a link to GMT-1 and name it CET-1 .

The best recommendation I can give you is to completely ignore the Etc directory and use some mapping table from Windows timezone names for folders / files in unix temporary space. Windows time zone information not only gives the GMT offset, but also knows about summer savings (and when it starts or ends). The same is true for folders / files in the timezone database, but not for files in the Etc directory - they give a simple static offset in GMT.

A list of time zones in the tz database can be found on wikipedia .

+2
source

If all files are reversed, then the files you are looking at are direct match offsets, while you are probably more familiar with reverse match offsets.

Windows usually uses the local time zone for the internal time of the machine, so it needs time zone files that can be translated to UTC. Linux typically uses UTC as the internal time of the machine, so it needs timezone files that can be translated to local time.

Since the offsets for the two machines describe additional, but opposite time directions, it is clear that time zone files are inversely related to each other. In other words, if you select a set of zone files from one, the other set will be negative.

+2
source

All Articles