Тема: Time Zone and DST
Hi Gt
Would you please let me know which commands responses are based on TZ and DST of user and which ones are based on GMT?
I want to know for which commands response we have to recalculate times based on user TZ and DST.
Вы не вошли. Пожалуйста, войдите или зарегистрируйтесь.
Hi Gt
Would you please let me know which commands responses are based on TZ and DST of user and which ones are based on GMT?
I want to know for which commands response we have to recalculate times based on user TZ and DST.
Hi Hamed,
In all requests you need to specify GMT+0 time, by default the responses will be also with GMT+0
But after login you can execute request render/set_locale to set user timezone for layers (messages) and reports.
Hi Diana
May you tell me when exactly I should execute render/set_locale? After login and only one time or before/after each messages request/report execution?
Hi Diana
May you tell me when exactly I should execute render/set_locale? After login and only one time or before/after each messages request/report execution?
Hi Hamed!
After login only, so you login, get session Id, execute request render/set_locale once time for this session.
If new session is activated, you need to execute the request to render/set_locale on new session.
Diana I have 2 other questions:
1. I see in documents that the flag can be 0,1 or 2 but the Wialon itself send flag 256. Please let me know what is that.
2. I call render/set_locale but when I put "formatDate":"%Y-%m-%E %H:%M:%S" and call it I receive error 4. Please let me know what I'm doing wrong.
http://hst-api.wialon.com/wialon/ajax.html?svc=render/set_locale¶ms={"tzOffset":134221328,"language":"fr","flags":256,"formatDate":"%Y-%m-%E %H:%M:%S"}&sid=SID
3. The case of time zone and daylight saving time confused me. As an example we have the Iran timezone and Iran daylight setting for a user:
A. We know that time zone is GMT+3:30 equal to +12600
B. We know that right know the daylight for Iran should be applied and the daylight offset is +1:00 which is equal to +3600
C. So now for this account we should have GMT+4:30 and in Wialon itself we see exactly same value in time current time section of bottom panel.
After we set mentioned time zone and daylight settings, we login with API as same user and we receive:
"prp": {
"dst": "-1",
"forceAddedDashboardTabOnce": "1",
"fpnl": "monitoring",
"geodata_source": "map_webgis",
"hbacit": "{\"hb_mi_dashboard\":{},\"hb_mi_monitoring\":{\"l\":1},\"hb_mi_routes\":{\"l\":1},\"hb_mi_messages\":{\"l\":1},\"hb_mi_reports_ctl\":{\"l\":1},\"hb_mi_geozones\":{\"l\":1},\"hb_mi_drivers\":{\"l\":1},\"hb_mi_trailers\":{\"l\":1},\"hb_mi_tags\":{\"l\":1},\"hb_mi_jobs\":{},\"hb_mi_notifications\":{},\"hb_mi_users\":{},\"hb_mi_devices\":{},\"hb_mi_tools\":{},\"hb_mi_apps\":{}}",
"hide_tl_promotion_tooltip": "1",
"hpnl": "hb_mi_monitoring",
"language": "en",
"minimap_zoom_level": "15",
"mont": "1",
"monu": "[23582700,23662294,23745708,23753307,23881796,23886522]",
"monuv": "[\"23662294\"]",
"mtg": "1",
"mu_fast_report_tmpl": "23978317_1",
"mu_fast_track_ival": "0",
"mu_tbl_cols_sizes": "ldt:256,0.22,0.26,0.26,0.26;ld:192,0.28,0.36,0.36;lt:192,0.28,0.36,0.36;dt:192,0.28,0.36,0.36;l:128,0.45,0.55;t:128,0.45,0.55;d:128,0.45,0.55;f:430,1",
"notify_block_account": "0",
"radd": "{\"w\":\"4\",\"c\":1,\"u\":23662294,\"a\":1,\"td\":1,\"s\":\"default\",\"f\":32}",
"show_log": "0",
"tz": "168571192",
"umap": "g.vector@modern",
"unit_extra_order": "1:connection,sensorValues,messageParams,customFields,profileFields,serviceIntervals,trailers,drivers",
"us_addr_fmt": "1255211008_10_5",
"us_addr_ordr": "1255211008"
}
As you see the value for the parameters "dst" and "tz" are "-1" and "168571192" respectively.
first of all, I can't understand the value "-1" for "dst"
Then, if we do the calculation that is explained in http://sdk.wialon.com/wiki/en/sidebar/r … me/example as Reverse operation, we will reach to the value of +12600 (Equal to +3:30).
I expect +4:30, why +3:30? If it's correct then how we should find the daylight saving time? If the "dst" value was "+1" we could say sum these values and you will reach to +4:30, but now, I got confused.
Hi Hamed,
1. flags value is 256 , just default value which uses when nothing should be changed.
You can use this flag like described in documentation,
2. For "formatDate" you need to URL-encoded % and : symbols, like %25 and %3A, space to %20
"%25E-%25m-%25Y%20%25H%3A%25M%3A%25S"
https://www.w3schools.com/tags/ref_urlencode.ASP
3. The value for Iran timezone GMT+3:30 is 12600
DST time is 0x0A0C0000 = 168558592 (dec) - Iran: from March 22 to September 22 (from March 21 to September 21 in a leap year)
So you need set up both (sum of timezone + DST) for "tzOffset":168571192 = 168558592 +12600
as your add DST value to tz , Wialon will be add 1 hour to GMT+3:30 , so it will +4.30 during DST period (from March 22 - Sep 22) , after Sep 22 the time will be automatically changed - minus 1 hour. So it doesn't need to edit timezone after 22 Sep
Diana, thank you for your prompt response.
The response as you see says:
"tz": "168571192"
Please let me know how from 168571192 should we reach to >>> Iran timezone GMT+3:30 = 12600 and DST time 0x0A0C0000 = 168558592 (dec)
Considering http://sdk.wialon.com/wiki/en/sidebar/r … me/example
Show me step-by-step calculation
Diana, thank you for your prompt response.
The response as you see says:
"tz": "168571192"
Please let me know how from 168571192 should we reach to >>> Iran timezone GMT+3:30 = 12600 and DST time 0x0A0C0000 = 168558592 (dec)
Considering http://sdk.wialon.com/wiki/en/sidebar/r … me/example
Show me step-by-step calculation
If the timezone value is positive, like GMT+3:30 you can just sum up 2 values : DST value (168558592) plus time 12600
or 168571192 - DST value (168558592) = 12600
it's the same as using binary operation AND:
A0C3138 (tz=168571192) ∧ FFFF = 3138 HEX (or 12600 dec)
Or get DST
A0C3138∧0fff0000 (the mask for DST) = A0C0000 (or 168558592 in dec)
Diana, let me ask my question another way. Simply, we receive "tz": "168571192" from an account. How to understand what is the Time Zone and DST from 168571192. How to calculate Time Zone and DST from 168571192. Is it clear?
Other questions are: what is what is the meaning of "dst": "-1" in login response? Which other values can have the "dst" parameter and what's the meaning of other values?
Diana, let me ask my question another way. Simply, we receive "tz": "168571192" from an account. How to understand what is the Time Zone and DST from 168571192. How to calculate Time Zone and DST from 168571192. Is it clear?
Other questions are: what is what is the meaning of "dst": "-1" in login response? Which other values can have the "dst" parameter and what's the meaning of other values?
Hi Hamed,
the parameter 'dst' is not used, only used parameter 'tz' which value includes both timezone and DST