CURLINFO_STARTTRANSFER_TIME_T.3 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. .\" generated by cd2nroff 0.1 from CURLINFO_STARTTRANSFER_TIME_T.md
  2. .TH CURLINFO_STARTTRANSFER_TIME_T 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLINFO_STARTTRANSFER_TIME_T \- 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_T,
  9. curl_off_t *timep);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a pointer to a curl_off_t to receive the time, in microseconds,
  13. it took from the
  14. start until the first byte is received by libcurl. This includes
  15. \fICURLINFO_PRETRANSFER_TIME_T(3)\fP and also the time the server needs to
  16. calculate the result.
  17. When a redirect is followed, the time from each request is added together.
  18. See also the TIMES overview in the \fIcurl_easy_getinfo(3)\fP man page.
  19. .SH PROTOCOLS
  20. This functionality affects all supported protocols
  21. .SH EXAMPLE
  22. .nf
  23. int main(void)
  24. {
  25. CURL *curl = curl_easy_init();
  26. if(curl) {
  27. CURLcode res;
  28. curl_off_t start;
  29. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  30. res = curl_easy_perform(curl);
  31. if(CURLE_OK == res) {
  32. res = curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME_T, &start);
  33. if(CURLE_OK == res) {
  34. printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", start / 1000000,
  35. (long)(start % 1000000));
  36. }
  37. }
  38. /* always cleanup */
  39. curl_easy_cleanup(curl);
  40. }
  41. }
  42. .fi
  43. .SH AVAILABILITY
  44. Added in curl 7.61.0
  45. .SH RETURN VALUE
  46. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  47. .SH SEE ALSO
  48. .BR CURLINFO_STARTTRANSFER_TIME (3),
  49. .BR CURLOPT_TIMEOUT (3),
  50. .BR curl_easy_getinfo (3),
  51. .BR curl_easy_setopt (3)