论坛元老
- 积分
- 3155
- 金钱
- 3155
- 注册时间
- 2017-7-10
- 在线时间
- 360 小时
|
发表于 2018-7-12 16:59:59
|
显示全部楼层
分享一下时间解析,供学习参考
if(WIFIUART_RX_STA & 0x8000)
{
WIFIUART_RX_BUF[WIFIUART_RX_STA & 0x7ff] = 0;
//printf("%s\r\n",WIFIUART_RX_BUF);
if(strstr((char*)WIFIUART_RX_BUF,(char*)resp))
{
p_end = (u8*)strstr((char*)WIFIUART_RX_BUF,(char*)resp);
p = p_end - 9;
nwt->hour = ((*p - 0x30)*10 + (*(p+1) - 0x30) + 8) % 24; //GMT0-->GMT8
nwt->min = ((*(p+3) - 0x30)*10 + (*(p+4) - 0x30)) % 60;
nwt->sec = ((*(p+6) - 0x30)*10 + (*(p+7) - 0x30)) % 60;
nwt->year = ((*(p-5) - 0x30)*1000 + (*(p-4) - 0x30)*100+ (*(p-3) - 0x30)*10+ (*(p-2) - 0x30));
nwt->date = ((*(p-12) - 0x30)*10 + (*(p-11) - 0x30));
if ((u8*)strstr((char*)WIFIUART_RX_BUF,(char*) "Jan")) nwt->month=1;
else if ((u8*)strstr((char*)WIFIUART_RX_BUF,(char*) "Feb")) nwt->month=2;
else if ((u8*)strstr((char*)WIFIUART_RX_BUF,(char*) "Mar")) nwt->month=3;
else if ((u8*)strstr((char*)WIFIUART_RX_BUF,(char*) "Apr")) nwt->month=4;
else if ((u8*)strstr((char*)WIFIUART_RX_BUF,(char*) "May")) nwt->month=5;
else if ((u8*)strstr((char*)WIFIUART_RX_BUF,(char*) "Jun")) nwt->month=6;
else if ((u8*)strstr((char*)WIFIUART_RX_BUF,(char*) "Jul")) nwt->month=7;
else if ((u8*)strstr((char*)WIFIUART_RX_BUF,(char*) "Aug")) nwt->month=8;
else if ((u8*)strstr((char*)WIFIUART_RX_BUF,(char*) "Sep")) nwt->month=9;
else if ((u8*)strstr((char*)WIFIUART_RX_BUF,(char*) "Oct")) nwt->month=10;
else if ((u8*)strstr((char*)WIFIUART_RX_BUF,(char*) "Nov")) nwt->month=11;
else if ((u8*)strstr((char*)WIFIUART_RX_BUF,(char*) "Dec")) nwt->month=12;
WIFIUART_RX_STA = 0;
break;
}
WIFIUART_RX_STA = 0;
} |
|