1CURLINFO_STARTTRANSFER_TIME(3) libcurl CURLINFO_STARTTRANSFER_TIME(3)
2
3
4
6 CURLINFO_STARTTRANSFER_TIME - get the time until the first byte is re‐
7 ceived
8
10 #include <curl/curl.h>
11
12 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_STARTTRANSFER_TIME,
13 double *timep);
14
16 Pass a pointer to a double to receive the time, in seconds, it took
17 from the start until the first byte is received by libcurl. This in‐
18 cludes CURLINFO_PRETRANSFER_TIME(3) and also the time the server needs
19 to calculate the result.
20
21 When a redirect is followed, the time from each request is added to‐
22 gether.
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 start;
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_STARTTRANSFER_TIME, &start);
37 if(CURLE_OK == res) {
38 printf("Time: %.1f", start);
39 }
40 }
41 /* always cleanup */
42 curl_easy_cleanup(curl);
43 }
44
46 Added in 7.9.2
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_STARTTRANS‐
54 FER_TIME_T(3)
55
56
57
58ibcurl 8.2.1 April 26, 2023 CURLINFO_STARTTRANSFER_TIME(3)