cruzccl commented on this pull request.


>                               VAL_NULL(db_cdr_vals+i)=0;
                                if(string2time(&cdr_value_array[i], 
&timeval_val) < 0) {
                                        LM_ERR("failed to convert string to 
timeval.\n");
                                        goto error;
                                }
-                               VAL_TIME(db_cdr_vals+i) = timeval_val.tv_sec;
+                               if (acc_time_mode==4) {
+                                       VAL_TYPE(db_cdr_vals+i)=DB1_STR;
+                                       t = gmtime(&timeval_val.tv_sec);
+                                       /* Convert time_t structure to format 
accepted by the database */
+                                       if (strftime(cdr_time_format_buf[i], 
TIME_STR_BUFFER_SIZE, TIME_STRING_FORMAT, t) <= 0) {
+                                               cdr_time_format_buf[i][0] = 
'\0';
+                                       }
+
+                                       VAL_STR(db_cdr_vals+i) = 
(str){cdr_time_format_buf[i], TIME_STR_BUFFER_SIZE-1};

I am not sure if it's compliant, but I am sure that the way you propose is more 
legible and clean.

I have already changed it.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1368#discussion_r157181495
_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to