CURLINFO_STARTTRANSFER_TIME.3 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. .\" generated by cd2nroff 0.1 from CURLINFO_STARTTRANSFER_TIME.md
  2. .TH CURLINFO_STARTTRANSFER_TIME 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLINFO_STARTTRANSFER_TIME \- get the time until the first byte is received
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_STARTTRANSFER_TIME,
  9. double *timep);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a pointer to a double to receive the time, in seconds, it took from the
  13. start until the first byte is received by libcurl. This includes
  14. \fICURLINFO_PRETRANSFER_TIME(3)\fP and also the time the server needs to
  15. calculate the result.
  16. When a redirect is followed, the time from each request is added together.
  17. See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
  18. .SH PROTOCOLS
  19. This functionality affects all supported protocols
  20. .SH EXAMPLE
  21. .nf
  22. int main(void)
  23. {
  24. CURL *curl = curl_easy_init();
  25. if(curl) {
  26. CURLcode res;
  27. double start;
  28. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  29. res = curl_easy_perform(curl);
  30. if(CURLE_OK == res) {
  31. res = curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, &start);
  32. if(CURLE_OK == res) {
  33. printf("Time: %.1f", start);
  34. }
  35. }
  36. /* always cleanup */
  37. curl_easy_cleanup(curl);
  38. }
  39. }
  40. .fi
  41. .SH AVAILABILITY
  42. Added in curl 7.9.2
  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_STARTTRANSFER_TIME_T (3),
  47. .BR CURLOPT_TIMEOUT (3),
  48. .BR curl_easy_getinfo (3),
  49. .BR curl_easy_setopt (3)