CURLINFO_TOTAL_TIME.3 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. .\" generated by cd2nroff 0.1 from CURLINFO_TOTAL_TIME.md
  2. .TH CURLINFO_TOTAL_TIME 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLINFO_TOTAL_TIME \- get total time of previous transfer
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TOTAL_TIME, double *timep);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a pointer to a double to receive the total time in seconds for the
  12. previous transfer, including name resolving, TCP connect etc. The double
  13. represents the time in seconds, including fractions.
  14. When a redirect is followed, the time from each request is added together.
  15. See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
  16. .SH PROTOCOLS
  17. This functionality affects all supported protocols
  18. .SH EXAMPLE
  19. .nf
  20. int main(void)
  21. {
  22. CURL *curl = curl_easy_init();
  23. if(curl) {
  24. CURLcode res;
  25. double total;
  26. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  27. res = curl_easy_perform(curl);
  28. if(CURLE_OK == res) {
  29. res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total);
  30. if(CURLE_OK == res) {
  31. printf("Time: %.1f", total);
  32. }
  33. }
  34. /* always cleanup */
  35. curl_easy_cleanup(curl);
  36. }
  37. }
  38. .fi
  39. .SH AVAILABILITY
  40. Added in curl 7.4.1
  41. .SH RETURN VALUE
  42. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  43. .SH SEE ALSO
  44. .BR CURLINFO_TOTAL_TIME_T (3),
  45. .BR CURLOPT_TIMEOUT (3),
  46. .BR curl_easy_getinfo (3),
  47. .BR curl_easy_setopt (3)