|
当模组连上机智云服务器后,通过
void gizwitsGetNTP(void)
{
int32_t ret = 0;
protocolCommon_t getNTP;
gizProtocolHeadInit((protocolHead_t *)&getNTP);
getNTP.head.cmd = CMD_GET_NTP;
getNTP.head.sn = gizwitsProtocol.sn++;
getNTP.head.len = exchangeBytes(sizeof(protocolCommon_t)-4);
getNTP.sum = gizProtocolSum((uint8_t *)&getNTP, sizeof(protocolCommon_t));
ret = uartWrite((uint8_t *)&getNTP, sizeof(protocolCommon_t));
if(ret < 0)
{
GIZWITS_LOG("ERR[NTP]: uart write error %d \n", ret);
}
gizProtocolWaitAck((uint8_t *)&getNTP, sizeof(protocolCommon_t));
}
获取网络时间
/** Protocol network time structure */
typedef struct
{
uint16_t year;
uint8_t month;
uint8_t day;
uint8_t hour;
uint8_t minute;
uint8_t second;
uint32_t ntp;
}protocolTime_t;
但是网络时间的结构体是protocolTime_t
我的问题:gizwitsGetNTP()函数没有对protocolTime_t时间结构体中元素的数据进行更新,如何获取获取到网络时间。
备注:非串口打印GIZWITS_LOG("WIFI_NTP : [%d-%d-%d %02d:%02d:%02d][%d] \n",ptime->year,ptime->month,ptime->day,ptime->hour,ptime->minute,ptime->second,ptime->ntp);
在我的UI界面上显示。没明白这个网络时间是如何获取更新的,求大神指教!
|
|