[sr-dev] [kamailio/kamailio] acc: use acc.time_mode to save cdrs in gmtime (#1368)
Carlos Cruz Luengo
notifications at github.com
Fri Dec 15 12:41:43 CET 2017
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20171215/a1045bd6/attachment.html>
More information about the sr-dev
mailing list