CURLINFO_TOTAL_TIME_T.3 1.5 KB

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