1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLINFO_NAMELOOKUP_TIME_T 5Section: 3 6Source: libcurl 7See-also: 8 - CURLINFO_NAMELOOKUP_TIME (3) 9 - curl_easy_getinfo (3) 10 - curl_easy_setopt (3) 11--- 12 13# NAME 14 15CURLINFO_NAMELOOKUP_TIME_T - get the name lookup time in microseconds 16 17# SYNOPSIS 18 19~~~c 20#include <curl/curl.h> 21 22CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NAMELOOKUP_TIME_T, 23 curl_off_t *timep); 24~~~ 25 26# DESCRIPTION 27 28Pass a pointer to a curl_off_t to receive the total time in microseconds 29from the start until the name resolving was completed. 30 31When a redirect is followed, the time from each request is added together. 32 33See also the TIMES overview in the curl_easy_getinfo(3) man page. 34 35# PROTOCOLS 36 37All 38 39# EXAMPLE 40 41~~~c 42int main(void) 43{ 44 CURL *curl = curl_easy_init(); 45 if(curl) { 46 CURLcode res; 47 curl_off_t namelookup; 48 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 49 res = curl_easy_perform(curl); 50 if(CURLE_OK == res) { 51 res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &namelookup); 52 if(CURLE_OK == res) { 53 printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", namelookup / 1000000, 54 (long)(namelookup % 1000000)); 55 } 56 } 57 /* always cleanup */ 58 curl_easy_cleanup(curl); 59 } 60} 61~~~ 62 63# AVAILABILITY 64 65Added in 7.61.0 66 67# RETURN VALUE 68 69Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 70