[svn-commits] mjordan: trunk r407748 - in /trunk: ./ funcs/func_cdr.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Feb 7 13:40:26 CST 2014


Author: mjordan
Date: Fri Feb  7 13:40:23 2014
New Revision: 407748

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=407748
Log:
funcs/func_cdr: Handle empty time values when extracting parsed values

When extracting timestamps that are parsed, time stamp values that are not set
(time values of 0.000000) should not actually result in a parsed string. The
value should be skipped, and the result of the CDR function should be an
empty string.

Prior to this patch, the result was fed to the time formatting, which would
result in an output of a date/time in 1969.
........

Merged revisions 407747 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/funcs/func_cdr.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/funcs/func_cdr.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_cdr.c?view=diff&rev=407748&r1=407747&r2=407748
==============================================================================
--- trunk/funcs/func_cdr.c (original)
+++ trunk/funcs/func_cdr.c Fri Feb  7 13:40:23 2014
@@ -291,9 +291,13 @@
 					args.variable, tempbuf, ast_channel_name(payload->chan));
 				return;
 			}
-			fmt_time.tv_usec = tv_usec;
-			ast_localtime(&fmt_time, &tm, NULL);
-			ast_strftime(tempbuf, sizeof(tempbuf), "%Y-%m-%d %T", &tm);
+			if (fmt_time.tv_sec) {
+				fmt_time.tv_usec = tv_usec;
+				ast_localtime(&fmt_time, &tm, NULL);
+				ast_strftime(tempbuf, sizeof(tempbuf), "%Y-%m-%d %T", &tm);
+			} else {
+				tempbuf[0] = '\0';
+			}
 		} else if (!strcasecmp("disposition", args.variable)) {
 			int disposition;
 




More information about the svn-commits mailing list