Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/304.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 窗口上的卷曲精度_Python_Windows_Curl_Libcurl - Fatal编程技术网

Python 窗口上的卷曲精度

Python 窗口上的卷曲精度,python,windows,curl,libcurl,Python,Windows,Curl,Libcurl,在windows中,pycurl将计时精度提高到小数点后3位,是否有方法将其提高到更精确的程度 > print c.getinfo(pycurl.CONNECT_TIME) > 0.265 例如,Linux将其设置为大约7位小数。查看pycurl的源代码,它只是调用底层的cURL函数: case CURLINFO_CONNECT_TIME: // other cases [snip]ped /* Return PyFloat as result */

在windows中,pycurl将计时精度提高到小数点后3位,是否有方法将其提高到更精确的程度

> print c.getinfo(pycurl.CONNECT_TIME)
> 0.265

例如,Linux将其设置为大约7位小数。

查看pycurl的源代码,它只是调用底层的cURL函数:

case CURLINFO_CONNECT_TIME: // other cases [snip]ped
        /* Return PyFloat as result */
        double d_res = 0.0;

        res = curl_easy_getinfo(self->handle, (CURLINFO)option, &d_res);
        if (res != CURLE_OK) {
            CURLERROR_RETVAL();
        }
        return PyFloat_FromDouble(d_res);
    }
而这反过来又起作用

case CURLINFO_CONNECT_TIME:
    *param_doublep = data->progress.t_connect;
    break;
t_connect

data->progress.t_connect = Curl_tvdiff_secs(now, data->progress.t_startsingle);
它引用了由定义为

struct timeval curlx_tvnow(void)
{
  /*
  ** GetTickCount() is available on _all_ Windows versions from W95 up
  ** to nowadays. Returns milliseconds elapsed since last system boot,
  ** increases monotonically and wraps once 49.7 days have elapsed.
  */
  struct timeval now;
  DWORD milliseconds = GetTickCount();
  now.tv_sec = milliseconds / 1000;
  now.tv_usec = (milliseconds % 1000) * 1000;
  return now;
}
也就是说,毫秒精度


这么短的补丁和重新编译cURL使用更高精度的计时器,然后编译pyCURL对这一点,不。对不起

查看pycurl的源代码,它只是调用底层的cURL函数:

case CURLINFO_CONNECT_TIME: // other cases [snip]ped
        /* Return PyFloat as result */
        double d_res = 0.0;

        res = curl_easy_getinfo(self->handle, (CURLINFO)option, &d_res);
        if (res != CURLE_OK) {
            CURLERROR_RETVAL();
        }
        return PyFloat_FromDouble(d_res);
    }
而这反过来又起作用

case CURLINFO_CONNECT_TIME:
    *param_doublep = data->progress.t_connect;
    break;
t_connect

data->progress.t_connect = Curl_tvdiff_secs(now, data->progress.t_startsingle);
它引用了由定义为

struct timeval curlx_tvnow(void)
{
  /*
  ** GetTickCount() is available on _all_ Windows versions from W95 up
  ** to nowadays. Returns milliseconds elapsed since last system boot,
  ** increases monotonically and wraps once 49.7 days have elapsed.
  */
  struct timeval now;
  DWORD milliseconds = GetTickCount();
  now.tv_sec = milliseconds / 1000;
  now.tv_usec = (milliseconds % 1000) * 1000;
  return now;
}
也就是说,毫秒精度


这么短的补丁和重新编译cURL使用更高精度的计时器,然后编译pyCURL对这一点,不。对不起

恐怕这是底层libcurl代码中的一个限制。它在Windows中使用GetTickCount()函数调用,即:

GetTickCount函数的分辨率仅限于 系统计时器的分辨率,通常在10范围内 毫秒到16毫秒


恐怕这是底层libcurl代码中的一个限制。它在Windows中使用GetTickCount()函数调用,即:

GetTickCount函数的分辨率仅限于 系统计时器的分辨率,通常在10范围内 毫秒到16毫秒