CURLINFO_N...KUP_TIME_T(3)

πŸ’– NAME πŸ’–

okay so this is the CURLINFO_N...KUP_TIME_T(3) page from the Library Functions Manual, and it’s literally about CURLINFO_NAMELOOKUP_TIME_T β€” name lookup time in microseconds ✨


✨ SYNOPSIS ✨

#include <curl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NAMELOOKUP_TIME_T,
                           curl_off_t *timep);

πŸ¦‹ DESCRIPTION πŸ¦‹

bestie, you pass a pointer to a curl_off_t, and it receives the total time in microseconds from the start until the name resolving was completed πŸ’…

when a redirect is followed, the time from each request is added together, periodt ⭐

also go peek at the TIMES overview in the curl_easy_getinfo(3) man page, iykyk 🫢


🌈 PROTOCOLS 🌈

this functionality affects all supported protocols 🌸


πŸ“ EXAMPLE πŸ“

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_off_t namelookup;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
    result = curl_easy_perform(curl);
    if(CURLE_OK == result) {
      result = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T,
                                 &namelookup);
      if(CURLE_OK == result) {
        printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", namelookup / 1000000,
               (long)(namelookup % 1000000));
      }
    }
    /* always cleanup */
    curl_easy_cleanup(curl);
  }
}

⭐ AVAILABILITY ⭐

added in curl 7.61.0 πŸ‘‘


πŸŽ€ RETURN VALUE πŸŽ€

curl_easy_getinfo(3) returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK, and non-zero means an error occurred β€” see libcurl-errors(3) for the deets πŸ’€


πŸ’… SEE ALSO πŸ’…


xoxo, your libcurl bestie πŸ’– β€” source/version: libcurl, dated 2026-10-12, page: CURLINFO_N...KUP_TIME_T(3) πŸ¦‹

πŸ“¦ where this page comes from