mirror of
https://github.com/curl/curl.git
synced 2026-08-24 22:03:33 +03:00
src/tool: allow timeouts to accept decimal values
Implement wrappers around strtod to convert the user argument to a double with sane error checking. Use this to allow --max-time and --connect-timeout to accept decimal values instead of strictly integers. The manpage is updated to make mention of this feature and, additionally, forewarn that the actual timeout of the operation can vary in its precision (particularly as the value increases in its decimal precision).
This commit is contained in:
parent
c0a7a98aee
commit
d8c04909fa
6 changed files with 58 additions and 8 deletions
|
|
@ -498,7 +498,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||
GetStr(&config->egd_file, nextarg);
|
||||
break;
|
||||
case 'c': /* connect-timeout */
|
||||
err = str2unum(&config->connecttimeout, nextarg);
|
||||
err = str2udouble(&config->connecttimeout, nextarg);
|
||||
if(err)
|
||||
return err;
|
||||
break;
|
||||
|
|
@ -1404,7 +1404,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||
break;
|
||||
case 'm':
|
||||
/* specified max time */
|
||||
err = str2unum(&config->timeout, nextarg);
|
||||
err = str2udouble(&config->timeout, nextarg);
|
||||
if(err)
|
||||
return err;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue