#include <stdio.h>
#include <stdlib.h>
typedef struct
{
unsigned char DeviceID[10];//IMEI
unsigned char date[50];
unsigned char time[50];
int tempature;
int humidity;
int voltage;
int current;
float longitude;
float latigude;
int airDistance;
char errorCode;
}Info_send;
typedef struct
{
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
}timebase;
int time;
Info_send message_Send;
char timestring[30];
char timerecord[20];
int flag;
int main()
{
timebase tm;
strcpy(timestring,"+CCLK: \"21/07/23,14:56:30+32\"");
printf("%s\n",timestring);
sscanf(timestring,"+CCLK: \"%d/%d/%d,%d:%d:%d\"",&tm.tm_year,&tm.tm_mon,&tm.tm_mday,&tm.tm_hour,&tm.tm_min,&tm.tm_sec);
printf("%d-%d-%d %d:%d:%d\n",tm.tm_year,tm.tm_mon,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec);
//从缓冲区中解析json结构
//printf("%c\n",timestring[8]);
//结构体数据赋予字符串
//strcpy(message_Send.DeviceID,"YRA001");
//printf("%s\n",message_Send.DeviceID);
return 0;
}
06-22
350
