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.
17
18 This time-stamp includes all pre-transfer commands and negotiations
19 that are specific to the particular protocol(s) involved. It includes
20 the sending of the protocol- specific protocol instructions that trig‐
21 gers a transfer.
22
23 When a redirect is followed, the time from each request is added to‐
24 gether.
25
26 See also the TIMES overview in the curl_easy_getinfo(3) man page.
27
29 All
30
32 curl = curl_easy_init();
33 if(curl) {
34 double pretransfer;
35 curl_easy_setopt(curl, CURLOPT_URL, url);
36 res = curl_easy_perform(curl);
37 if(CURLE_OK == res) {
38 res = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &pretransfer);
39 if(CURLE_OK == res) {
40 printf("Time: %.1f", pretransfer);
41 }
42 }
43 /* always cleanup */
44 curl_easy_cleanup(curl);
45 }
46
48 Added in 7.4.1
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_PRETRANS‐
56 FER_TIME_T(3)
57
58
59
60libcurl 7.76.1 January 14, 2021 CURLINFO_PRETRANSFER_TIME(3)