1

Different time zones

Тема: Different time zones

Hello,

We are having problems to consume the service, the problem is that we are making a request like the request that execute from wialonHosting, but the response is not the same.

Our request and response is

Request URL:https://hst-api.wialon.com/wialon/ajax.html?svc=report/exec_report&sid=013803936fadf513aa7ed947
params:{"reportResourceId":13776566,"reportTemplateId":15,"reportTemplate":null,"reportObjectId":13791155,"reportObjectSecId":0,"interval":{"flags":16777216,"from":1474693200,"to":1474779599}}

Response
{"reportResult":{"msgsRendered":1,"stats":[],"tables":[{"name":"unit_ecodriving","label":"Conducción eficiente","grouping":{"nested":{"type":"criterion"},"type":"day"},"flags":16777616,"rows":2,"level":3,"columns":13,"header":["Grouping","Infracción","Comienzo","Posición inicial","Fin","Posición final","Valor","Velocidad máxima","Multas","Kilometraje","Conductor","Valoración","Cantidad"],"total":["Total","","14:04:51","Las Chichipicas, Res Chichipicas, Toluca, México 50160, Mexico","04:18:40","Las Chichipicas, Res Chichipicas, Toluca, México 50160, Mexico","","64 km\/h","153","42.67 km","CARLOS","3.4","153"],"totalRaw":[{"v":0,"vt":0},{"v":4294967295,"vt":0},{"v":1474725891,"vt":31},{"v":0,"vt":1},{"v":1474777120,"vt":31},{"v":0,"vt":1},{"v":0,"vt":0},{"v":64,"vt":20},{"v":153,"vt":110},{"v":42672.7203951,"vt":10},{"v":0,"vt":0},{"v":3.4,"vt":111},{"v":153,"vt":2}]}],"attachments":[{"name":"Gráfica","type":"chart","datasets":["Velocidad, km\/h"],"axis_y":["Speed, km\/h"],"axis_x":"Time","flags":532,"p":{"sensor_mask":"*"}}]},"reportLayer":{"name":"report unit_msgs","bounds":[19.253771,-99.660512,19.287843,-99.574166],"units":[{"id":13791155,"msgs":{"count":884,"first":{"time":1474693220,"lat":19.2763690948,"lon":-99.6159667969},"last":{"time":1474779474,"lat":19.2764205933,"lon":-99.6159820557}},"mileage":42672.7203951,"max_speed":85}]},"layerCount":4}

The WialonHosting request and response is

Request URL:https://hst-api.wialon.com/wialon/ajax.html?svc=report/exec_report&sid=01394dbe605185e847393669

params:{"reportResourceId":13776566,"reportTemplateId":15,"reportTemplate":null,"reportObjectId":13791155,"reportObjectSecId":0,"interval":{"flags":16777216,"from":1474693200,"to":1474779599}}

Response
{"reportResult":{"msgsRendered":1,"stats":[],"tables":[{"name":"unit_ecodriving","label":"Conducción eficiente","grouping":{"nested":{"type":"criterion"},"type":"day"},"flags":16777616,"rows":1,"level":3,"columns":13,"header":["Grouping","Infracción","Comienzo","Posición inicial","Fin","Posición final","Valor","Velocidad máxima","Multas","Kilometraje","Conductor","Valoración","Cantidad"],"total":["Total","","09:04:51","Las Chichipicas, Res Chichipicas, Toluca, México 50160, Mexico","23:18:40","Las Chichipicas, Res Chichipicas, Toluca, México 50160, Mexico","","64 km\/h","153","42.67 km","CARLOS","3.4","153"],"totalRaw":[{"v":0,"vt":0},{"v":4294967295,"vt":0},{"v":1474725891,"vt":31},{"v":0,"vt":1},{"v":1474777120,"vt":31},{"v":0,"vt":1},{"v":0,"vt":0},{"v":64,"vt":20},{"v":153,"vt":110},{"v":42672.7203951,"vt":10},{"v":0,"vt":0},{"v":3.4,"vt":111},{"v":153,"vt":2}]}],"attachments":[{"name":"Gráfica","type":"chart","datasets":["Velocidad, km\/h"],"axis_y":["Speed, km\/h"],"axis_x":"Time","flags":532,"p":{"sensor_mask":"*"}}]},"reportLayer":{"name":"report unit_msgs","bounds":[19.253771,-99.660512,19.287843,-99.574166],"units":[{"id":13791155,"msgs":{"count":884,"first":{"time":1474693220,"lat":19.2763690948,"lon":-99.6159667969},"last":{"time":1474779474,"lat":19.2764205933,"lon":-99.6159820557}},"mileage":42672.7203951,"max_speed":85}]},"layerCount":4}

Do you know why the response is not the same if the request is the same?


We ask wialon support, and his answer was.

It seems you have a different time zones, that's why with the same request you get the different data.
The second request you used has a -5 time zone in comparison with the first request.
Mexico","04:18:40"
Mexico","23:18:40"

"Total","","14:04:51"
"Total","","09:04:51"

So before you're executing the exec_report request you should set the time zone
https://sdk.wialon.com/wiki/en/sidebar/ … set_locale


but we do not know how to use this function  in javascript:

svc=render/set_locale&params={"tzOffset":<uint>,
                  "language":<text>,
                  "flags":<uint>,
                  "formatDate":<text>,
                  "density":<uint>}

We hope you could help with this. Thanks!