CURLINFO_PRETRANSFER_TIME.3 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. .\" generated by cd2nroff 0.1 from CURLINFO_PRETRANSFER_TIME.md
  2. .TH CURLINFO_PRETRANSFER_TIME 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLINFO_PRETRANSFER_TIME \- get the time until the file transfer start
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRETRANSFER_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 file transfer is just about to begin.
  14. This time\-stamp includes all pre\-transfer commands and negotiations that are
  15. specific to the particular protocol(s) involved. It includes the sending of
  16. the protocol\-specific instructions that trigger a transfer.
  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. double pretransfer;
  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_PRETRANSFER_TIME, &pretransfer);
  33. if(CURLE_OK == res) {
  34. printf("Time: %.1f", pretransfer);
  35. }
  36. }
  37. /* always cleanup */
  38. curl_easy_cleanup(curl);
  39. }
  40. }
  41. .fi
  42. .SH AVAILABILITY
  43. Added in curl 7.4.1
  44. .SH RETURN VALUE
  45. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  46. .SH SEE ALSO
  47. .BR CURLINFO_CONNECT_TIME_T (3),
  48. .BR CURLINFO_PRETRANSFER_TIME_T (3),
  49. .BR curl_easy_getinfo (3),
  50. .BR curl_easy_setopt (3)