1CURLINFO_TOTAL_TIME(3) curl_easy_getinfo options CURLINFO_TOTAL_TIME(3)
2
3
4
6 CURLINFO_TOTAL_TIME - get total time of previous transfer
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TOTAL_TIME, double
12 *timep);
13
15 Pass a pointer to a double to receive the total time in seconds for the
16 previous transfer, including name resolving, TCP connect etc. The dou‐
17 ble represents the time in seconds, including fractions.
18
19 When a redirect is followed, the time from each request is added
20 together.
21
22 See also the TIMES overview in the curl_easy_getinfo(3) man page.
23
25 All
26
28 curl = curl_easy_init();
29 if(curl) {
30 double total;
31 curl_easy_setopt(curl, CURLOPT_URL, url);
32 res = curl_easy_perform(curl);
33 if(CURLE_OK == res) {
34 res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total);
35 if(CURLE_OK == res) {
36 printf("Time: %.1f", total);
37 }
38 }
39 /* always cleanup */
40 curl_easy_cleanup(curl);
41 }
42
44 Added in 7.4.1
45
47 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
48 if not.
49
51 curl_easy_getinfo(3), curl_easy_setopt(3), CURLINFO_TOTAL_TIME_T(3)
52
53
54
55libcurl 7.69.1 August 26, 2019 CURLINFO_TOTAL_TIME(3)