miconda 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};
Is this cast compliant with strict C standard? Kamailio is used on some
old/embedded systems with more strict compilers.
Otherwise, I think this should just be a DB1_STRING data type, because the
buffer is zero-terminated.
--
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#pullrequestreview-83776806
_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev