diff options
author | snuffy <snuffy@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-06-08 23:48:17 +0000 |
---|---|---|
committer | snuffy <snuffy@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-06-08 23:48:17 +0000 |
commit | b9d2b2684d6dfde3759cbbc84dfb6aa11d0e3b60 (patch) | |
tree | b9c0a6d9e565124104804ec2cb1e31a3c6b5ea41 /cdr/cdr_pgsql.c | |
parent | 6db8e08fa31bc24296db13621a207e435834fdcd (diff) |
Add High Resolution Times to CDRs for Asterisk
People expressed an interest in having access to the exact length of calls to a finer degree than seconds. See the CHANGES and UPGRADE.txt for usage also updated the sample configs to note the change.
Patch by snuffy.
(closes issue #16559)
Reported by: cianmaher
Tested by: cianmaher, snuffy
Review: https://reviewboard.asterisk.org/r/461/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@269153 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr/cdr_pgsql.c')
-rw-r--r-- | cdr/cdr_pgsql.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c index eae092642..53e957c26 100644 --- a/cdr/cdr_pgsql.c +++ b/cdr/cdr_pgsql.c @@ -211,12 +211,12 @@ static int pgsql_log(struct ast_cdr *cdr) } else if (strncmp(cur->type, "float", 5) == 0) { struct timeval *when = cur->name[0] == 'd' ? &cdr->start : &cdr->answer; LENGTHEN_BUF2(31); - ast_str_append(&sql2, 0, "%s%f", first ? "" : ",", (double)cdr->end.tv_sec - when->tv_sec + cdr->end.tv_usec / 1000000.0 - when->tv_usec / 1000000.0); + ast_str_append(&sql2, 0, "%s%f", first ? "" : ",", (double) (ast_tvdiff_us(cdr->end, *when) / 1000000.0)); } else { /* Char field, probably */ struct timeval *when = cur->name[0] == 'd' ? &cdr->start : &cdr->answer; LENGTHEN_BUF2(31); - ast_str_append(&sql2, 0, "%s'%f'", first ? "" : ",", (double)cdr->end.tv_sec - when->tv_sec + cdr->end.tv_usec / 1000000.0 - when->tv_usec / 1000000.0); + ast_str_append(&sql2, 0, "%s'%f'", first ? "" : ",", (double) (ast_tvdiff_us(cdr->end, *when) / 1000000.0)); } } else if (strcmp(cur->name, "disposition") == 0 || strcmp(cur->name, "amaflags") == 0) { if (strncmp(cur->type, "int", 3) == 0) { |