1CURLINFO_TOTAL_TIME_T(3) curl_easy_getinfo options CURLINFO_TOTAL_TIME_T(3)
2
3
4
6 CURLINFO_TOTAL_TIME_T - get total time of previous transfer in mi‐
7 croseconds
8
10 #include <curl/curl.h>
11
12 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TOTAL_TIME_T,
13 curl_off_t *timep);
14
16 Pass a pointer to a curl_off_t to receive the total time in microsec‐
17 onds for the previous transfer, including name resolving, TCP connect
18 etc. The curl_off_t represents the time in microseconds.
19
20 When a redirect is followed, the time from each request is added to‐
21 gether.
22
23 See also the TIMES overview in the curl_easy_getinfo(3) man page.
24
26 All
27
29 curl = curl_easy_init();
30 if(curl) {
31 curl_off_t total;
32 curl_easy_setopt(curl, CURLOPT_URL, url);
33 res = curl_easy_perform(curl);
34 if(CURLE_OK == res) {
35 res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &total);
36 if(CURLE_OK == res) {
37 printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", total / 1000000,
38 (long)(total % 1000000));
39 }
40 }
41 /* always cleanup */
42 curl_easy_cleanup(curl);
43 }
44
46 Added in 7.61.0
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_TOTAL_TIME(3)
54
55
56
57libcurl 8.0.1 January 02, 2023 CURLINFO_TOTAL_TIME_T(3)