Hi Diana,
Thank you for your response.
I understand a majority of what you explained, however I’m stuck on where I can find out what daylight saving time was selected when user saves Time Zone.
Here is example from beginning to end.
User selected timezone, International Date Line West: -43200
-43200 (32 bit) binary using two’s complement method = 11111111111111110101011101000000
We need to perform the operation with mask 0xf000ffff, which has binary equals to = 11110000000000001111111111111111
11111111111111110101011101000000 & 11110000000000001111111111111111 = -1111111111111010100011000000
-1111111111111010100011000000 = -268413120
And we are going to select daylight time saving United States, Canada: from second Sunday in March to first Sunday in November with mask value equals to 0x0A010000
-268413120 (32 bit) binary using two’s complement method equals to = 11110000000000000101011101000000
Daylight time saving mask 0x0A010000 binary is equals to = 1010000000010000000000000000
11110000000000000101011101000000 | 1010000000010000000000000000 = -101111111101010100011000000
-101111111101010100011000000 = -100575424
We are on track so far!
Now to reverse the saved settings.
-100575424 (32 bit) binary using two’s complement method = 11111010000000010101011101000000
We need to perform an operation with mask 0xffff, which has binary equals to = 1111111111111111
11111010000000010101011101000000 & 1111111111111111 = 101011101000000
101011101000000 = 22336
To find out what timezone user selected, we need to perform OR operation with mask 0xffff0000
22336 (32 bit) binary using two’s complement method equals to = 00000000000000000101011101000000
We need to perform | (OR) operation with mask 0xffff0000, which has binary equals to = 11111111111111110000000000000000
00000000000000000101011101000000 | 11111111111111110000000000000000 = -1010100011000000
-1010100011000000 = -43200
We successfully reversed timezone value -43200, International Date Line Wes.
But I cannot not understand how to reverse daylight time saving United States, Canada: from second Sunday in March to first Sunday in November value during the process
Your hints and direction would be highly appreciated.
Thank you,