summaryrefslogtreecommitdiff
path: root/funcs
diff options
context:
space:
mode:
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_cdr.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/funcs/func_cdr.c b/funcs/func_cdr.c
index 0f900feda..492716dcf 100644
--- a/funcs/func_cdr.c
+++ b/funcs/func_cdr.c
@@ -248,11 +248,14 @@ static int cdr_read(struct ast_channel *chan, const char *cmd, char *parse,
|| !strcasecmp("answer", args.variable)) {
struct timeval fmt_time;
struct ast_tm tm;
- if (sscanf(tempbuf, "%ld.%ld", &fmt_time.tv_sec, &fmt_time.tv_usec) != 2) {
+ /* tv_usec is suseconds_t, which could be int or long */
+ long int tv_usec;
+ if (sscanf(tempbuf, "%ld.%ld", &fmt_time.tv_sec, &tv_usec) != 2) {
ast_log(AST_LOG_WARNING, "Unable to parse %s (%s) from the CDR for channel %s\n",
args.variable, tempbuf, ast_channel_name(chan));
return 0;
}
+ fmt_time.tv_usec = tv_usec;
ast_localtime(&fmt_time, &tm, NULL);
ast_strftime(tempbuf, sizeof(*tempbuf), "%Y-%m-%d %T", &tm);
} else if (!strcasecmp("disposition", args.variable)) {