This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
en:sidebar:remoteapi:apiref:format:time:example [13/01/2016 10:13] stan [Reverse operation] |
en:sidebar:remoteapi:apiref:format:time:example [03/03/2021 08:55] chdi [Example of time zone receiving tz] |
||
---|---|---|---|
Line 6: | Line 6: | ||
---- | ---- | ||
1. Mathematical AND should be applied to the Azores [[timezone|timezone]] using **0xf000ffff** mask. | 1. Mathematical AND should be applied to the Azores [[timezone|timezone]] using **0xf000ffff** mask. | ||
+ | Each time decimal signed value shoud be perfomed to binary value using [[http://https://www.exploringbinary.com/twos-complement-converter/| decimal to two’s complement ]]method | ||
<code=javascript> | <code=javascript> | ||
-3600 & 0xf000ffff | -3600 & 0xf000ffff | ||
Line 19: | Line 20: | ||
=====Reverse operation===== | =====Reverse operation===== | ||
+ | tz=-134155792 | ||
- | Time zone is presented as signed short. | + | 1) Mathematical AND should be applied to the ‘tz’ parameter using **0xffff** mask. |
- | + | ||
- | tz=-134155792 in hex 0xf800f1f0 | + | |
- | + | ||
- | 1) Value using **0x0fff0000** mask is [[dst|dst]]. | + | |
- | 0x08000000 - none. | + | |
- | + | ||
- | 2) Value using **0xffff** mask is Time zone. | + | |
- | ---- | + | |
<code=javascript> | <code=javascript> | ||
- | 0xf1f0 | + | -134155792 & 0xffff |
+ | 61936 | ||
+ | </code> | ||
+ | <note important> Only if the original tz value < 0 (it is in this example), then mathematical OR should be applied to the result using the mask 0xffff0000. If tz value > 0, the following step is not needed.</note> | ||
+ | 2) Mathematical OR should be applied to the result using the mask **0xffff0000**. | ||
+ | <code=javascript> | ||
+ | 61936 | 0xffff0000 | ||
-3600 | -3600 | ||
</code> | </code> | ||
+ | [[timezone|timezone]] (-01:00) Azores. | ||
+ | ---- | ||
+ | tz=-134155792 in hex 0xf800f1f0 | ||
- | [[timezone|Time zone]] (-01:00) Azores. | + | Value using **0x0fff0000** mask is [[dst|dst]]. |
+ | 0x08000000 - none. |
|