1CURLINFO_NAMELOOKUP_TIME_T(3c)url_easy_getinfo optioCnUsRLINFO_NAMELOOKUP_TIME_T(3)
2
3
4
6 CURLINFO_NAMELOOKUP_TIME_T - get the name lookup time in microseconds
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NAMELOOKUP_TIME_T,
12 curl_off_t *timep);
13
15 Pass a pointer to a curl_off_t to receive the total time in microsec‐
16 onds from the start until the name resolving was completed.
17
18 See also the TIMES overview in the curl_easy_getinfo(3) man page.
19
21 All
22
24 curl = curl_easy_init();
25 if(curl) {
26 curl_off_t namelookup;
27 curl_easy_setopt(curl, CURLOPT_URL, url);
28 res = curl_easy_perform(curl);
29 if(CURLE_OK == res) {
30 res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &namelookup);
31 if(CURLE_OK == res) {
32 printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", namelookup / 1000000,
33 (long)(namelookup % 1000000));
34 }
35 }
36 /* always cleanup */
37 curl_easy_cleanup(curl);
38 }
39
41 Added in 7.61.0
42
44 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
45 if not.
46
48 curl_easy_getinfo(3), curl_easy_setopt(3), CURLINFO_NAMELOOKUP_TIME(3)
49
50
51
52libcurl 7.64.0 May 17, 2018 CURLINFO_NAMELOOKUP_TIME_T(3)