Getting time form the mc60 module through network

Dear Team,
I have written the below code to get time from the network. but I am not getting any value from the module please validate my code and tell me what mistake I did.

/******************************************************************************

  • Function: ATResponse_CLK_Handler
  • Description:
  •           This function is used to deal with the response of the AT+CSQ command.
    
  • Parameters:
  •            line:
    
  •                [in]The address of the string.
    
  •            len:
    
  •                [in]The length of the string.
    
  •            userdata:
    
  •                [out]Used to transfer the customer's parameter.
    
  • Return:
  •           RIL_ATRSP_SUCCESS, indicates AT executed successfully..
    
  •           RIL_ATRSP_FAILED, indicates AT executed failed.
    
  •           RIL_ATRSP_CONTINUE,indicates continue to wait for the response
    
  •           of the AT command.
    
  • Notes:
  •           1.Can't send any new AT commands in this function.
    
  •           2.RIL handle the AT response line by line, so this function may
    
  •             be called multiple times.
    

****************************************************************************/
static s32 ATResponse_CCLK_Handler(char
line, u32 len, void
userdata)
{
ST_CCLK_Reponse CCLK_Reponse = (ST_CCLK_Reponse)userdata;

char *head = Ql_RIL_FindString(line, len, "+CCLK:"); //continue wait
if(head)
{
    Ql_sscanf(head,"%*[^ ]%s,%s,%[^\r\n]",&CCLK_Reponse->Date,&CCLK_Reponse->Time);
    return  RIL_ATRSP_CONTINUE;
}

head = Ql_RIL_FindLine(line, len, "OK"); // find <CR><LF>OK<CR><LF>, <CR>OK<CR>£¬<LF>OK<LF>
if(head)
{
    return  RIL_ATRSP_SUCCESS;
}

head = Ql_RIL_FindLine(line, len, "ERROR");// find <CR><LF>ERROR<CR><LF>, <CR>ERROR<CR>£¬<LF>ERROR<LF>
if(head)
{
    return  RIL_ATRSP_FAILED;
}

head = Ql_RIL_FindString(line, len, "+CME ERROR:");//fail
if(head)
{
    return  RIL_ATRSP_FAILED;
}

return RIL_ATRSP_CONTINUE; //continue wait

}

/******************************************************************************

  • Function: RIL_NW_GetNetworkTime
  • Description:
  •           This function gets the network time form the GSM.
    
  • Parameters:
  •           Date:
    
  •               [out] output buffer for the Date.
    
  •           Time:
    
  •               [out] output buffer for the Time.
    
  • Return:
  •            RIL_AT_SUCCESS,send AT successfully.
    
  •            RIL_AT_FAILED, send AT failed.
    
  •            RIL_AT_TIMEOUT,send AT timeout.
    
  •            RIL_AT_BUSY,   sending AT.
    
  •            RIL_AT_INVALID_PARAM, invalid input parameter.
    
  •            RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY
    
  •                                  and then call Ql_RIL_Initialize to initialize RIL.
    

***************************************************************************/
s32 RIL_NW_GetNetworkTime(char
Date, char
Time)
{
s32 retRes = 0;
char strAT[] = “AT+CCLK?\0”;
ST_CCLK_Reponse pCCLK_Reponse;
Ql_memset(&pCCLK_Reponse,0, sizeof(pCCLK_Reponse));
retRes = Ql_RIL_SendATCmd(strAT,Ql_strlen(strAT), ATResponse_CCLK_Handler,(void
)&pCCLK_Reponse,0);
if(RIL_AT_SUCCESS == retRes)
{
strcpy(Date , pCCLK_Reponse.Date);
strcpy(Time , pCCLK_Reponse.Time);
//*Date = pCCLK_Reponse.Date;
//*Time = pCCLK_Reponse.Time;
}

return retRes;

}

hi team i got the solution get the local time function i have written the function for this

/******************************************************************************

  • Function: ATResponse_CLK_Handler
  • Description:
  •           This function is used to deal with the response of the AT+CSQ command.
    
  • Parameters:
  •            line:
    
  •                [in]The address of the string.
    
  •            len:
    
  •                [in]The length of the string.
    
  •            userdata:
    
  •                [out]Used to transfer the customer's parameter.
    
  • Return:
  •           RIL_ATRSP_SUCCESS, indicates AT executed successfully..
    
  •           RIL_ATRSP_FAILED, indicates AT executed failed.
    
  •           RIL_ATRSP_CONTINUE,indicates continue to wait for the response
    
  •           of the AT command.
    
  • Notes:
  •           1.Can't send any new AT commands in this function.
    
  •           2.RIL handle the AT response line by line, so this function may
    
  •             be called multiple times.
    

****************************************************************************/
static s32 ATResponse_CCLK_Handler(char
line, u32 len, void
userdata)
{
ST_CCLK_Reponse CCLK_Reponse = (ST_CCLK_Reponse)userdata;

char *head = Ql_RIL_FindString(line, len, "+CCLK:"); //continue wait
if(head)
{
    Ql_sscanf(head,"%*[^ ]%s,%[^\r\n]",&CCLK_Reponse->Date_Time);
    return  RIL_ATRSP_CONTINUE;
}

head = Ql_RIL_FindLine(line, len, "OK"); // find <CR><LF>OK<CR><LF>, <CR>OK<CR>£¬<LF>OK<LF>
if(head)
{
    return  RIL_ATRSP_SUCCESS;
}

head = Ql_RIL_FindLine(line, len, "ERROR");// find <CR><LF>ERROR<CR><LF>, <CR>ERROR<CR>£¬<LF>ERROR<LF>
if(head)
{
    return  RIL_ATRSP_FAILED;
}

head = Ql_RIL_FindString(line, len, "+CME ERROR:");//fail
if(head)
{
    return  RIL_ATRSP_FAILED;
}

return RIL_ATRSP_CONTINUE; //continue wait

}

/******************************************************************************

  • Function: RIL_NW_GetNetworkTime
  • Description:
  •           This function gets the network time form the GSM.
    
  • Parameters:
  •           Date:
    
  •               [out] output buffer for the Date.
    
  •           Time:
    
  •               [out] output buffer for the Time.
    
  • Return:
  •            RIL_AT_SUCCESS,send AT successfully.
    
  •            RIL_AT_FAILED, send AT failed.
    
  •            RIL_AT_TIMEOUT,send AT timeout.
    
  •            RIL_AT_BUSY,   sending AT.
    
  •            RIL_AT_INVALID_PARAM, invalid input parameter.
    
  •            RIL_AT_UNINITIALIZED, RIL is not ready, need to wait for MSG_ID_RIL_READY
    
  •                                  and then call Ql_RIL_Initialize to initialize RIL.
    

****************************************************************************/
s32 RIL_NW_GetNetworkTime(char
Date_Time)
{
s32 retRes = 0;
char strAT[] = “AT+CCLK?\0”;
ST_CCLK_Reponse pCCLK_Reponse;
Ql_memset(&pCCLK_Reponse,0, sizeof(pCCLK_Reponse));
retRes = Ql_RIL_SendATCmd(strAT,Ql_strlen(strAT), ATResponse_CCLK_Handler,(void
)&pCCLK_Reponse,0);
if(RIL_AT_SUCCESS == retRes)
{
strcpy(Date_Time, pCCLK_Reponse.Date_Time);
//*Date = pCCLK_Reponse.Date;
//*Time = pCCLK_Reponse.Time;
}

return retRes;

}

typedef struct{
char Date_Time[15];
}ST_CCLK_Reponse;

add this code into your network.h and network.c file and call this function in your main file and as respectively

i go the output for this

The Time and Date of the Device is “21/04/17,11:28:23+22”