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