1CURLINFO_STARTTRANSFER_TIME_cTu(r3l)_easy_getinfo opCtUiRoLnIsNFO_STARTTRANSFER_TIME_T(3)
2
3
4
6 CURLINFO_STARTTRANSFER_TIME_T - get the time until the first byte is
7 received
8
10 #include <curl/curl.h>
11
12 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_STARTTRANSFER_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 first byte is received by libcurl. This
18 includes CURLINFO_PRETRANSFER_TIME_T(3) and also the time the server
19 needs to calculate the result.
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 curl_off_t 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_T, &start);
37 if(CURLE_OK == res) {
38 printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", start / 1000000,
39 (long)(start % 1000000));
40 }
41 }
42 /* always cleanup */
43 curl_easy_cleanup(curl);
44 }
45
47 Added in 7.61.0
48
50 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
51 if not.
52
54 curl_easy_getinfo(3), curl_easy_setopt(3), CURLINFO_STARTTRANSā
55 FER_TIME(3)
56
57
58
59libcurl 7.69.1 August 26, 2019CURLINFO_STARTTRANSFER_TIME_T(3)