CURLINFO_NAMELOOKUP_TIME_T.3 1.5 KB

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