ESP8266_RTOS_ALINK_DEMO怎样获取服务器时间(不是UTC)?

sdlo77
Posts: 2
Joined: Fri Sep 23, 2016 8:37 pm

ESP8266_RTOS_ALINK_DEMO怎样获取服务器时间(不是UTC)?

Postby sdlo77 » Fri Sep 23, 2016 8:58 pm

当设备端连接网络,注册成功后,可以正常运行。怎样定时从服务器读取北京时间?

/***
* @desc: Get alink time. The SDK sync with server every 30 minutes
* or anytime if SDK is notified by the server if the timestamp is out order.
* @para: None
* @retc: utc time, the number of seconds since Epoth.
*/
unsigned int alink_get_time(void);
这个函数要转换比较麻烦。

ESP_Xutao
Posts: 134
Joined: Tue Sep 27, 2016 5:42 pm

Re: ESP8266_RTOS_ALINK_DEMO怎样获取服务器时间(不是UTC)?

Postby ESP_Xutao » Tue Nov 29, 2016 5:02 pm

你好!
获取服务器时间:
1.在服务器的下发的json包中有相对的时间,需要解析一下。如“time”:“1476169824”.
2.你可以自己打一个NTP服务器,可以获取服务器时间。
3.现在发布新的RTOS SDK,已经包括NTP,相对获取时间容易多了。

Who is online

Users browsing this forum: No registered users and 58 guests