@cruzccl commented on this pull request.


In src/modules/acc/acc_cdr.c:

>  				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, view it on GitHub, or mute the thread.