[svn-commits] mjordan: branch 12 r407747 - /branches/12/funcs/func_cdr.c

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


Author: mjordan
Date: Fri Feb  7 13:36:15 2014
New Revision: 407747

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=407747
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.

Modified:
    branches/12/funcs/func_cdr.c

Modified: branches/12/funcs/func_cdr.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/funcs/func_cdr.c?view=diff&rev=407747&r1=407746&r2=407747
==============================================================================
--- branches/12/funcs/func_cdr.c (original)
+++ branches/12/funcs/func_cdr.c Fri Feb  7 13:36:15 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