CURLINFO_CONNECT_TIME.3 1.3 KB

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