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 When a redirect is followed, the time from each request is added to‐
19 gether.
20
21 See also the TIMES overview in the curl_easy_getinfo(3) man page.
22
24 All
25
27 curl = curl_easy_init();
28 if(curl) {
29 curl_off_t namelookup;
30 curl_easy_setopt(curl, CURLOPT_URL, url);
31 res = curl_easy_perform(curl);
32 if(CURLE_OK == res) {
33 res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &namelookup);
34 if(CURLE_OK == res) {
35 printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", namelookup / 1000000,
36 (long)(namelookup % 1000000));
37 }
38 }
39 /* always cleanup */
40 curl_easy_cleanup(curl);
41 }
42
44 Added in 7.61.0
45
47 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
48 if not.
49
51 curl_easy_getinfo(3), curl_easy_setopt(3), CURLINFO_NAMELOOKUP_TIME(3)
52
53
54
55libcurl 7.82.0 November 26, 2021 CURLINFO_NAMELOOKUP_TIME_T(3)