GNURLINFO...KUP_TIME_T(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ¦‹ GNURLINFO...KUP_TIME_T(3) πŸ¦‹

okay so bestie, you found the manual page for GNURLINFO...KUP_TIME_T(3) in the curl_easy_getinfo options manual, and it is literally all about getting the name lookup time in microseconds. tiny units, big main character energy ✨


🌸 NAME 🌸

CURLINFO_NAMELOOKUP_TIME_T β€” get the name lookup time in microseconds πŸ’…

✨ SYNOPSIS ✨

       #include <gnurl/curl.h>

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

πŸ’– DESCRIPTION πŸ’–

okay so 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. lowkey precise, highkey useful 🫢

When a redirect is followed, the time from each request is added together. no cap, it stacks πŸ’…

also go peek at the TIMES overview in the curl_easy_getinfo(3) man page β€” it’s giving the big picture 🌈

πŸ¦‹ PROTOCOLS πŸ¦‹

All β€” every single protocol, slay ✨

πŸŽ€ EXAMPLE πŸŽ€

       curl = curl_easy_init();
       if(curl) {
         curl_off_t namelookup;
         curl_easy_setopt(curl, CURLOPT_URL, url);
         res = curl_easy_perform(curl);
         if(CURLE_OK == res) {
           res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &namelookup);
           if(CURLE_OK == res) {
             printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", namelookup / 1000000,
                    (long)(namelookup % 1000000));
           }
         }
         /* always cleanup */
         curl_easy_cleanup(curl);
       }

🌈 AVAILABILITY 🌈

Added in 7.61.0 β€” periodt πŸŽ€

πŸ”₯ RETURN VALUE πŸ”₯

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. that’s the whole vibe check, bestie πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

curl_easy_getinfo(3), curl_easy_setopt(3), CURLINFO_NAMELOOKUP_TIME(3) β€” go read them, iykyk 🫢


xoxo, your Unix bestie πŸ’– β€” source/version: libcurl 7.61.0, date: 28 Apr 2018, footer title: GNURLINFO...KUP_TIME_T(3). now go get those microseconds, bestie πŸ¦‹

πŸ“¦ where this page comes from