GNURLINFO_CONNECT_TIME(3)

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

πŸ¦‹ GNURLINFO_CONNECT_TIME(3) πŸ¦‹

okay so bestie, welcome to the GNURLINFO_CONNECT_TIME(3) page β€” it lives in the curl_easy_getinfo options manual section, and it’s literally all about timing your connection. no cap, this one is short and sweet. πŸ’…


✨ NAME ✨

CURLINFO_CONNECT_TIME β€” get the time until connect ⏱️✨

πŸ’» SYNOPSIS πŸ’»

#include <gnurl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONNECT_TIME, double
*timep);

🌸 DESCRIPTION 🌸

okay so you pass a pointer to a double, and it receives the total time in seconds from the start until the connection to the remote host (or proxy) was completed. 🫢

when a redirect is followed, the time from each request is added together. yes bestie, it stacks. πŸ’…

also check out the TIMES overview in the curl_easy_getinfo(3) man page β€” that’s where the timing lore lives. πŸ‘‘

🌈 PROTOCOLS 🌈

All πŸ’― β€” every protocol, no gatekeeping.

πŸŽ€ EXAMPLE πŸŽ€

curl = curl_easy_init();
if(curl) {
  double connect;
  curl_easy_setopt(curl, CURLOPT_URL, url);
  res = curl_easy_perform(curl);
  if(CURLE_OK == res) {
    res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &connect);
    if(CURLE_OK == res) {
      printf("Time: %.1f", connect);
    }
  }
  /* always cleanup */
  curl_easy_cleanup(curl);
}

πŸ¦‹ AVAILABILITY πŸ¦‹

Added in 7.4.1 β€” vintage but iconic. ✨

πŸ’œ RETURN VALUE πŸ’œ

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

πŸ”₯ SEE ALSO πŸ”₯


mwah πŸ’‹ okay bestie, that’s the page. this one is from libcurl 7.44.0, dated 28 Aug 2015, and the footer title is GNURLINFO_CONNECT_TIME(3) β€” bye, love you, go time those connections fr fr 🫢✨

πŸ“¦ where this page comes from