Hi Yang,

>  
> +static void get_time(struct stk_response *rsp) {
> +     time_t now;
> +     struct tm *t;
> +
> +     time(&now);
> +     t = localtime(&now);
> +
> +     rsp->result.type = STK_RESULT_TYPE_SUCCESS;
> +
> +     if (t->tm_year > 100)
> +             rsp->provide_local_info.datetime.year = 
> t->tm_year - 100;
> +     else
> +             rsp->provide_local_info.datetime.year = t->tm_year;
> +

Incase of error, localtime shall return a null pointer. I think its
better to add the NULL check. 

Regards,
Jeevaka
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to