CURLINFO_CONNECT_TIME_T(3)

okay so bestie ๐Ÿ’… welcome to CURLINFO_CONNECT_TIME_T(3) โ€” it's from the Library Functions Manual โœจ. This page is literally about time to connect โฑ๏ธ and it's giving โ€œstopwatch but make it curlโ€ ๐Ÿซถ.

๐ŸŒธ NAME ๐ŸŒธ

CURLINFO_CONNECT_TIME_T โ€” time to connect โณ

โœจ SYNOPSIS โœจ

#include <curl/curl.h>

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

๐Ÿ’– DESCRIPTION ๐Ÿ’–

You pass a pointer to a curl_off_t and it receives the total time in microseconds from the start until the connection to the remote host (or proxy) was completed โฒ๏ธ. No cap, that's the whole vibe.

When a redirect is followed, the time from each request is added together ๐Ÿงฎ โ€” yes, all of them, summed.

Also peek at the TIMES overview in the curl_easy_getinfo(3) man page ๐Ÿ‘€.

๐Ÿฆ‹ PROTOCOLS ๐Ÿฆ‹

This functionality affects all supported protocols ๐ŸŒˆ.

๐ŸŽ€ EXAMPLE ๐ŸŽ€

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

โญ AVAILABILITY โญ

Added in curl 7.61.0 ๐ŸŽ‰.

๐Ÿ’… RETURN VALUE ๐Ÿ’…

๐ŸŒˆ SEE ALSO ๐ŸŒˆ


mwah ๐Ÿ’‹ and that's the tea โ€” this page is from libcurl, dated 2026-10-12, and the title is CURLINFO_CONNECT_TIME_T(3) ๐ŸŒˆโœจ.

๐Ÿ“ฆ where this page comes from