1CURLINFO_PRETRANSFER_TIME_T(c3u)rl_easy_getinfo optiCoUnRsLINFO_PRETRANSFER_TIME_T(3)
2
3
4
6 CURLINFO_PRETRANSFER_TIME_T - get the time until the file transfer
7 start
8
10 #include <curl/curl.h>
11
12 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRETRANSFER_TIME_T,
13 curl_off_t *timep);
14
16 Pass a pointer to a curl_off_t to receive the time, in microseconds, it
17 took from the start until the file transfer is just about to begin.
18 This includes all pre-transfer commands and negotiations that are spe‐
19 cific to the particular protocol(s) involved. It does not involve the
20 sending of the protocol- specific request that triggers a transfer.
21
22 When a redirect is followed, the time from each request is added
23 together.
24
25 See also the TIMES overview in the curl_easy_getinfo(3) man page.
26
28 All
29
31 curl = curl_easy_init();
32 if(curl) {
33 curl_off_t pretransfer;
34 curl_easy_setopt(curl, CURLOPT_URL, url);
35 res = curl_easy_perform(curl);
36 if(CURLE_OK == res) {
37 res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME_T, &pretransfer);
38 if(CURLE_OK == res) {
39 printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", pretransfer / 1000000,
40 (long)(pretransfer % 1000000));
41 }
42 }
43 /* always cleanup */
44 curl_easy_cleanup(curl);
45 }
46
48 Added in 7.61.0
49
51 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
52 if not.
53
55 curl_easy_getinfo(3), curl_easy_setopt(3), CURLINFO_PRETRANSFER_TIME(3)
56
57
58
59libcurl 7.66.0 August 26, 2019 CURLINFO_PRETRANSFER_TIME_T(3)