CURLINFO_NAMELOOKUP_TIME.3 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. .\" generated by cd2nroff 0.1 from CURLINFO_NAMELOOKUP_TIME.md
  2. .TH CURLINFO_NAMELOOKUP_TIME 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLINFO_NAMELOOKUP_TIME \- get the name lookup time
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NAMELOOKUP_TIME,
  9. double *timep);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a pointer to a double to receive the total time in seconds from the start
  13. 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. double 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, &namelookup);
  30. if(CURLE_OK == res) {
  31. printf("Time: %.1f", namelookup);
  32. }
  33. }
  34. /* always cleanup */
  35. curl_easy_cleanup(curl);
  36. }
  37. }
  38. .fi
  39. .SH AVAILABILITY
  40. Added in curl 7.4.1
  41. .SH RETURN VALUE
  42. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  43. .SH SEE ALSO
  44. .BR CURLINFO_NAMELOOKUP_TIME_T (3),
  45. .BR curl_easy_getinfo (3),
  46. .BR curl_easy_setopt (3)