CURLINFO_PRETRANSFER_TIME_T.3 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. .\" generated by cd2nroff 0.1 from CURLINFO_PRETRANSFER_TIME_T.md
  2. .TH CURLINFO_PRETRANSFER_TIME_T 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLINFO_PRETRANSFER_TIME_T \- 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_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, it took
  13. from the 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. curl_off_t 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_T, &pretransfer);
  33. if(CURLE_OK == res) {
  34. printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld\\n",
  35. pretransfer / 1000000,
  36. (long)(pretransfer % 1000000));
  37. }
  38. }
  39. /* always cleanup */
  40. curl_easy_cleanup(curl);
  41. }
  42. }
  43. .fi
  44. .SH AVAILABILITY
  45. Added in curl 7.61.0
  46. .SH RETURN VALUE
  47. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  48. .SH SEE ALSO
  49. .BR CURLINFO_CONNECT_TIME (3),
  50. .BR CURLINFO_PRETRANSFER_TIME_T (3),
  51. .BR curl_easy_getinfo (3),
  52. .BR curl_easy_setopt (3)