]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix func_timeout to take values in floating point so 1.5 actually means
authorRussell Bryant <russell@russellbryant.com>
Thu, 23 Aug 2007 19:21:53 +0000 (19:21 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 23 Aug 2007 19:21:53 +0000 (19:21 +0000)
1.5 seconds instead of being rounded.
(closes issue #10540, reported by spendergrass, patch by me)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@80539 65c4cc65-6c06-0410-ace0-fbb531ad65f3

funcs/func_timeout.c

index 7d9d535ea0eb9c338760c97c7d8e52633982f5d5..37b441127e32bc82c969c629cf8e73ffc2c89db9 100644 (file)
@@ -89,6 +89,7 @@ static int timeout_read(struct ast_channel *chan, char *cmd, char *data,
 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 @@ static int timeout_write(struct ast_channel *chan, char *cmd, char *data,
        if (!value)
                return -1;
 
-       x = atoi(value);
+       f = atof(value);
+       if (f < 0)
+               f = 1.0;
+       x = (int) (f * 1000);
 
        switch (*data) {
        case 'a':