[asterisk-commits] russell: branch 1.4 r80539 - /branches/1.4/funcs/func_timeout.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 23 14:21:54 CDT 2007


Author: russell
Date: Thu Aug 23 14:21:53 2007
New Revision: 80539

URL: http://svn.digium.com/view/asterisk?view=rev&rev=80539
Log:
Fix func_timeout to take values in floating point so 1.5 actually means
1.5 seconds instead of being rounded.
(closes issue #10540, reported by spendergrass, patch by me)

Modified:
    branches/1.4/funcs/func_timeout.c

Modified: branches/1.4/funcs/func_timeout.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/funcs/func_timeout.c?view=diff&rev=80539&r1=80538&r2=80539
==============================================================================
--- branches/1.4/funcs/func_timeout.c (original)
+++ branches/1.4/funcs/func_timeout.c Thu Aug 23 14:21:53 2007
@@ -89,6 +89,7 @@
 static int timeout_write(struct ast_channel *chan, char *cmd, char *data,
 			 const char *value)
 {
+	float f;
 	int x;
 	char timestr[64];
 	struct tm myt;
@@ -104,7 +105,10 @@
 	if (!value)
 		return -1;
 
-	x = atoi(value);
+	f = atof(value);
+	if (f < 0)
+		f = 1.0;
+	x = (int) (f * 1000);
 
 	switch (*data) {
 	case 'a':




More information about the asterisk-commits mailing list